简体   繁体   English

如何在nativescript中使用打字稿?

[英]How to use typescript in nativescript?

Can someone give me a detail steps how to setup typescript environment for nativescript? 谁能给我一个详细的步骤,如何为本地脚本设置打字稿环境?

lets say import fooModule = require('ui/image'); 可以说import fooModule = require('ui/image'); won't give me a red underline and error while compiling. 编译时不会给我红色下划线和错误。

As of NativeScript version 1.5, TypeScript is really easy to set up just by running 从NativeScript 1.5版开始,TypeScript真的很容易通过运行来设置

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 以下是有关如何设置的视频: 使用TypeScript和NativeScript的Hello World本机iOS移动应用程序

They ship with typescript definitions as tns-definitions-*.tgz that you need to extract and include in your project. 它们附带了打字稿定义,如tns-definitions-*.tgz ,您需要提取它们并将其包含在项目中。 Download is available from releases page eg https://github.com/NativeScript/NativeScript/releases/tag/v1.1.0 可从发布页面下载,例如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 注意:一旦我们拥有,它将变得更好: https : //github.com/Microsoft/TypeScript/issues/2338

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM