Reputation: 2322
I am new to NativeScript, new to VSCode and new to TypeScript definitions and am experiencing difficulties getting setup for VSCode to perform autocompletion through IntelliSense for modules required from tns-core-modules.
The dependencies from my package.json:
"dependencies": {
"lodash": "^4.17.4",
"nativescript-theme-core": "1.0.4",
"tns-core-modules": "3.2.0"
}
IntelliSense for lodash works perfectly as expected. However, IntelliSense for anything from tns-core-modules does not work.
I created a project from the blank-template in NativeScript's Sidekick. After googling around I added a jsconfig.json as follows:
{
"compilerOptions": {
"checkJs": true,
"target": "ES6",
"allowSyntheticDefaultImports": true
},
"include": [
"app/**/*"
]
}
CheckJS shows me this error in home-page.js
Hovering over the error it reads:
[js] Cannot find module 'ui/frame'.
I tried to do various things that I honestly, just don't understand like:
/// <reference path="../../node_modules/tns-core-modules/tns-core-modules.d.ts" />
/// <reference path="../../node_modules/tns-core-modules/ui/frame/frame.d.ts"/>
My understanding is that because "ui/frame" is not in the package.json, but nativeScript intelligently extracts the appropriate module from tns-core-modules based on what platform it's building for...
The big question is: How do you get VSCode to know about the proper mappings and make the connection between ui/frame and the appropriate "frame.d.ts".
Thanks in advance!
EDIT: I wanted to update any readers and let them know that I am not and do not want to write TypeScript code, but I do want VSCode to interpret the typescript definitions properly.
Upvotes: 0
Views: 732
Reputation: 2322
The answer to this is to use TypeScript. I couldn't get it to work without it.
Upvotes: 0