Nativescript: With tns-core-modules.es2016 nothing compiles to JS

Created on 21 Jan 2017  路  4Comments  路  Source: NativeScript/NativeScript

Dear friend, we, the rest of the NativeScript community really
appreciate your feedback! While we are doing all we can to take care of every
issue, sometimes we get overwhelmed. Because of that, we will consider issues
that are not constructive or problems that cannot be reproduced "dead".
Additionally, we will treat feature requests or bug reports with unanswered
questions regarding the behavior/reproduction for more than 20 days "dead". All
"dead" issues will get closed.

Please, provide the details below:

Did you verify this is a real problem by searching Stack Overflow and the other open issues in this repo?

Tried very hard to find anything useful without luck.

Tell us about the problem

Please, ensure your title is less than 63 characters long and starts with a capital
letter.

After changing to es2016 in references.d.ts nothing compiles to JavaScript.

Which platform(s) does your issue occur on?

Both

Please provide the following version numbers that your issue occurs with:

  • CLI: 2.4.2
  • Cross-platform modules: 2.6.0-2017-01-16-5416 but I tried with previous versions as well
  • Runtime(s): iOS 2.4.0, Android 2.4.1
  • Plugin(s): none

Please tell us how to recreate the issue in as much detail as possible.

After updating my "references.d.ts" file to use "./node_modules/tns-core-modules/tns-core-modules.es2016.d.ts" none of the tns commands are compiling TypeScript to JavaScript so the app will crash with "Could not find module './'." error.

I want to use "tns-platform-declarations" to marshall native code, as far as I know I need this setup but the documentation has nothing mentioned about it.

Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.

Here is my "tsconfig.json"

{
    "compilerOptions": {
        "module": "commonjs",
        "target": "es5",
        "removeComments": true,
        "experimentalDecorators": true,
        "emitDecoratorMetadata": true,
        "noEmitHelpers": true,
        "noEmitOnError": true,
        "lib": [
            "es2016"
        ]
    },
    "exclude": [
        "node_modules",
        "platforms",
        "**/*.aot.ts"
    ],
    "include": [
        "typings-i386/*",
        "Interop.d.ts"
    ]
}

Thank you!

android ios question

Most helpful comment

Thank you for your answer.
I realised if I remove the include ("typings-i386/*", "Interop.d.ts") from tsconfig.json and add "skipLibCheck: true" it will solve all my problems.
However I needed to remove all the platforms, reset the emulators and install everything again.

All 4 comments

@neonwarp

Apart from the settings in _tsconfig.json_ your _references.d.ts_ should look like this:

/// <reference path="./node_modules/tns-core-modules/tns-core-modules.es2016.d.ts" />

/// <reference path="./node_modules/tns-platform-declarations/ios.d.ts" />
/// <reference path="./node_modules/tns-platform-declarations/android.d.ts" />

Here is the README of tns-platform-declarations and here is the article section about enabling IntelliSense in the documentation (not live but in the master of the documentation branch - will go live with or next release). Hope that solves your issue - let me know if you need further assistance!

Thank you for your answer.
I realised if I remove the include ("typings-i386/*", "Interop.d.ts") from tsconfig.json and add "skipLibCheck: true" it will solve all my problems.
However I needed to remove all the platforms, reset the emulators and install everything again.

I had to set skipLibCheck=true, otherwise I saw lots of TS2304 errors during compilation. NS 2.5.0, TS 2.1.6

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings