@sapphire/ts-config
Version:
Shareable TypeScript configuration for the Sapphire Community
66 lines (48 loc) • 2.89 kB
Markdown
# Migration guide for /ts-config v4.x to v5.x
Between major version 4 and 5 of `/ts-config`, the package has been rewritten to fully leverage that TypeScript's `extends` feature now supports an array of config files.
The following configs have been removed:
- `/ts-config/extra-strict-without-decorators`
- `/ts-config/without-decorators`
The following changes have been applied to the base config:
- `experimentalDecorators` is now `false` by default
- `emitDecoratorMetadata` is now `false` by default
- `verbatimModuleSyntax` is now `false` by default. It gets set to true by `/ts-config/verbatim`.
- Note that you should not enable `/ts-config/verbatim` without also setting `"type"` in `package.json`
to either `"commonjs"` or `"module"`
The following configs have been added:
- `/ts-config/extra-strict`
- `/ts-config/decorators`
- `/ts-config/base` -> This is identical to `/ts-config`
- `/ts-config/verbatim`
- `/ts-config/bundler`
In order to achieve the following old configs you now need to use:
| Old config | New config |
| ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| `"@sapphire/ts-config"` | `["@sapphire/ts-config", "@sapphire/ts-config/decorators", "@sapphire/ts-config/verbatim"]` |
| `"@sapphire/ts-config/extra-strict"` | `["@sapphire/ts-config", "@sapphire/ts-config/extra-strict", "@sapphire/ts-config/decorators", "@sapphire/ts-config/verbatim"]` |
| `"@sapphire/ts-config/extra-strict-without-decorators"` | `["@sapphire/ts-config", "@sapphire/ts-config/extra-strict", "@sapphire/ts-config/verbatim"]` |
| `"@sapphire/ts-config/without-decorators"` | `["@sapphire/ts-config", "@sapphire/ts-config/verbatim"]` |
An example of a CJS project with extra-strict and no decorators would therefore be:
```json
{
"extends": ["@sapphire/ts-config", "@sapphire/ts-config/extra-strict", "@sapphire/ts-config/verbatim"]
}
```
and in your package.json make sure you add:
```json
{
"type": "commonjs"
}
```
And similarly an example of an ESM project with extra-strict and no decorators would therefore be:
```json
{
"extends": ["@sapphire/ts-config", "@sapphire/ts-config/extra-strict", "@sapphire/ts-config/verbatim"]
}
```
and in your package.json make sure you add:
```json
{
"type": "module"
}
```