https://github.com/thinkjs/think-typescript
Use TypeScript transpile ts to js
https://github.com/thinkjs/think-typescript
typescript
Last synced: about 1 year ago
JSON representation
Use TypeScript transpile ts to js
- Host: GitHub
- URL: https://github.com/thinkjs/think-typescript
- Owner: thinkjs
- License: mit
- Created: 2017-02-13T11:52:20.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2022-12-06T18:13:47.000Z (over 3 years ago)
- Last Synced: 2025-03-22T04:01:51.623Z (about 1 year ago)
- Topics: typescript
- Language: JavaScript
- Size: 314 KB
- Stars: 6
- Watchers: 4
- Forks: 2
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# think-typescript
# think-typescript
[](https://travis-ci.org/thinkjs/think-typescript)
[](https://coveralls.io/github/thinkjs/think-typescript?branch=master)
[](https://www.npmjs.com/package/think-typescript)
`think-typescript` compile typescript file
## Syntax
```js
import thinkTypescript from 'think-typescript';
thinkTypescript({
srcPath,
outPath,
file,
typescriptOptions,
ext,
});
```
- `srcPath` {String} the file source path.
- `outPath` {String} the directory for output file.
- `file` {String} the file path in the 'srcPath'.
- `[typescriptOptions]` {Object} the typescript options,default `{fileName: file, reportDiagnostics: true, compilerOptions: {module: 'commonjs', target: 'es5', sourceMap: true}}`.
- `[ext]` {String} the new file extension,default `.js`.
## Usage
Compile typescript file:
```js
import thinkTypescript from 'think-typescript';
thinkTypescript({
srcPath: './test/src/a',
outPath: './test/out',
file: 'b/test.ts'
});
```