百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
T

typescript

> 编程语言
开源

将 TypeScript 添加到 Meteor

99 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

将 TypeScript 添加到 Meteor

Deprecated! Use https://atmospherejs.com/adornis/typescript

TypeScript Compiler for Meteor

TypeScript files are compiled into ES5 and CommonJS modules by default.

Based on [email protected]

Default compiler options as JSON:

json
{
  "module": "commonjs",
  "target": "es5",
  "moduleResolution": "node",
  "experimentalDecorators": true,
  "emitDecoratorMetadata": true,
  "sourceMap": true
}

ES6

It's possible to use ES6 on the server with Meteor >= 1.4.

If you want to compile into ES6 on the server, put a tsconfig.json into the server folder:

json
{
  "compilerOptions": {
    "target": "ES6"
  }
}

Path mappings

TypeScript paths mapping is supported since 0.6.0, though, with some limitations. It works only for local files and for module: commonjs.

You can now use paths like imports/client/foo instead of Meteor rooted paths like /imports/client/foo if you add to the config.json as follows:

json
  "baseUrl": ".",
  "paths": {
    "*": ["*"]
  }

Typings

Install Meteor typings by npm i @types/meteor and you are ready to go.

Custom Typings

Typings files are processed in the same way as regular ts-files. If you place a declaration file into server folder it will be used only for the server code only.

Note that any change to a global declaration file will cause diagnostics re-evaluation. Hence, if you change some custom declaration file often, makes sence to reference it in some main ts-file and exclude in the config, i.e.:

typescript
 /// 
json
{
  "exclude": ["typings/foo.d.ts"]
}

Example

As an example, check out a simple TODO app built with Angular2 and TypeScript, https://github.com/Urigo/angular-meteor/tree/master/examples/todos-meteor-1.3

Package Structure

This package uses (directly or indirectly) three other packages, which are worth to mention:

typescript-compiler - exports a Meteor TypeScript compiler that implements Meteor compiler API. TypeScript compiler in its turn uses meteor-typescript package’s API to compile TypeScript source code incrementally on file changes.

meteor-typescript - an NPM package that exports an incremental TypeScript build class. That class is designed to be used in the series of subsequent compilations of TypeScript source code. In that case, TypeScript Service API, which is used internally, allows to reuse compilation statistics and data between subsequent builds, thus, improving speed of the compilation.

typescript-runtime - currently contains TypeScript helpers, which allow to configure behavior of some parts of the compiled TypeScript code for special use cases. One of the use cases is usage with the old browsers.

Credits

Thanks @urigo (Uri) for his support and resources to continue development of this project.

License

MIT

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

JavaScript

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言