How to use typescript in nativescript?

2.5k views Asked by At

Can someone give me a detail steps how to setup typescript environment for nativescript?

lets say import fooModule = require('ui/image'); won't give me a red underline and error while compiling.

2

There are 2 answers

0
basarat On BEST ANSWER

They ship with typescript definitions as tns-definitions-*.tgz that you need to extract and include in your project. Download is available from releases page e.g. https://github.com/NativeScript/NativeScript/releases/tag/v1.1.0

Note: It will get better once we have : https://github.com/Microsoft/TypeScript/issues/2338

0
Alex Ziskind On

As of NativeScript version 1.5, TypeScript is really easy to set up just by running

tns install typescript

inside your project directory. Here is a video on how to get set up: Hello World native iOS mobile app using TypeScript and NativeScript