admin 管理员组

文章数量: 1086019

I am looking to adopt NodeJS as a server language for a project. However, I am concerned with Javascript as a programming language and am also concerned the lack of type checking of Javascript.

Is there a way to introduce static typing in NodeJS? I have read about TypeScript. However, I am not sure how popular and well supported typeScript is.

For example, there are only 1400 questions on TypeScript on Stackoverflow.

Can anyone speak about TypeScript in production or any optional static typing for NodeJS?

I am looking to adopt NodeJS as a server language for a project. However, I am concerned with Javascript as a programming language and am also concerned the lack of type checking of Javascript.

Is there a way to introduce static typing in NodeJS? I have read about TypeScript. However, I am not sure how popular and well supported typeScript is.

For example, there are only 1400 questions on TypeScript on Stackoverflow.

Can anyone speak about TypeScript in production or any optional static typing for NodeJS?

Share Improve this question asked Oct 25, 2013 at 16:53 samolsamol 20.7k33 gold badges93 silver badges132 bronze badges 2
  • Dynamic typing is a strength of JavaScript. If you want static typing on your server-side code you should be using Java or C#. – Hector Correa Commented Oct 25, 2013 at 19:42
  • 1 Or NodeJS with TypeScript :) – Fenton Commented Oct 25, 2013 at 22:24
Add a ment  | 

2 Answers 2

Reset to default 6

Yes, you can use TypeScript to create node applications. There are several related node type definitions to assist with this at https://github./borisyankov/DefinitelyTyped. These definitions are required for the tsc piler to understand what your node-specific code is trying to do. Depending on your TS editor, they can also be used to provide intellisense while editing.

Here's a recent article that discusses how prevalent TypeScript is these days: http://blogs.msdn./b/typescript/archive/2013/10/17/typescript-and-the-road-to-1-0.aspx

Is there a way to introduce static typing in NodeJS?

There's a Node module for Typescript, instructions on the "get it" page on the Typescript site:

npm install -g typescript

Then you pile your Typescript (.ts) files to JavaScript:

tsc helloworld.ts

本文标签: javascriptIs statically typed nodeJS possible ie TypeScriptStack Overflow