Nativescript: @nativescript/core/platform declaration file syntax for `screen` and `device` breaks typescript builds without -skipLibCheck

Created on 5 Jan 2021  路  4Comments  路  Source: NativeScript/NativeScript

Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 7.0.11
  • Cross-platform modules: ^7.0.13
  • Android Runtime: 7.0.1
  • iOS Runtime: 7.0.6
  • XCode Version: N/A
  • Plugin(s): None

Describe the bug
Running a tsc build without -skipLibCheck with the latest @nativescript/core emits errors about the lowercase compat screen and device platform declarations that were reintroduced in https://github.com/NativeScript/NativeScript/commit/4204ac8308eda902efd787ce96971463eab343ab.

./node_modules/.bin/tsc
node_modules/@nativescript/core/platform/index.d.ts:129:23 - error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.

129 export const screen = Screen;
                          ~~~~~~

node_modules/@nativescript/core/platform/index.d.ts:141:23 - error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.

141 export const device = Device;
                          ~~~~~~


Found 2 errors.

To Reproduce

git clone https://github.com/dapriett/nativescript-google-maps-sdk.git
cd ./nativescript-google-maps-sdk/src/
./node_modules/.bin/ts-patch install
./node_modules/.bin/tsc

Expected behavior
Builds successfully

Sample project
Above

Additional context

bug

All 4 comments

I believe the linked PR should fix this - need to confirm before merging/releasing.

Wow had my PR ready and you still beat me to it, yes that seems to fix it.

Haha, awesome timing! I'm happy to merge your version if you'd like! 馃殌

Go with yours, I'll be quicker on the next one 馃槃

Was this page helpful?
0 / 5 - 0 ratings