-
Notifications
You must be signed in to change notification settings - Fork 11
Installation
Roman Jámbor edited this page Feb 1, 2022
·
2 revisions
- Install packages.
npm i tst-reflect && npm i tst-reflect-transformer -D
- In order to use transformer plugin you need TypeScript compiler which supports plugins eg. package ttypescript or you can use TypeScript compiler API manually.
npm i ttypescript -D
- Add transformer to
tsconfig.json
{
"compilerOptions": {
// your options...
// ADD THIS!
"plugins": [
{
"transform": "tst-reflect-transformer"
}
]
}
}
- Now just transpile your code by
ttsc
instead oftsc
npx ttsc
Modify your webpack config. Use options.compiler
of ts-loader
to set ttypescript
compiler.
({
test: /\.(ts|tsx)$/,
loader: require.resolve("ts-loader"),
options: {
compiler: "ttypescript"
}
})
Install Parcel plugin.
npm i parcel-plugin-ttypescript
Install Rollup plugin
npm i rollup-plugin-typescript2
and modify your rollup config.
import ttypescript from "ttypescript";
import tsPlugin from "rollup-plugin-typescript2";
export default {
// your options...
plugins: [
// ADD THIS!
tsPlugin({
typescript: ttypescript
})
]
}
Modify your tsconfig.json
.
{
"compilerOptions": {
// your options...
"plugins": [
{
"transform": "tst-reflect-transformer"
}
]
},
// ADD THIS!
"ts-node": {
// This can be omitted when using ts-patch
"compiler": "ttypescript"
},
}