Custom Typescript Settings

Hello, I am reading the documentation on the subject of injecting custom Typescript Settings, I can clearly see the docs mention the ability to modify or add settings without breaking the grander configuration, What is missing is an actual example where and how you apply settings. For example, If I want to set compilerOptions.experimentalDecorators: true how would I best go about this?
6 Replies
MarcusNarcus
MarcusNarcusOP6mo ago
My first assumption is just putting the attributes I want to change into ./tsconfig.json like so:
{
// https://nuxt.com/docs/guide/concepts/typescript
"extends": "./.nuxt/tsconfig.json",
"compilerOptions": {
"allowImportingTsExtensions": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true
}
}
{
// https://nuxt.com/docs/guide/concepts/typescript
"extends": "./.nuxt/tsconfig.json",
"compilerOptions": {
"allowImportingTsExtensions": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true
}
}
Appears to be working without any obvious breakages to the original config, please let me know if this the correct approach?
Cue
Cue6mo ago
What you’re doing is fine. You can also just set those flags in your nuxt config https://nuxt.com/docs/api/nuxt-config#tsconfig
Nuxt
Nuxt Configuration
Discover all the options you can use in your nuxt.config.ts file.
MarcusNarcus
MarcusNarcusOP6mo ago
Thank you
Cue
Cue6mo ago
For example:
{
typescript: {
tsConfig: {
compilerOptions: {
allowImportingTsExtensions: true,
experimentalDecorators: true,
emitDecoratorMetadata: true
}
}
}
}
{
typescript: {
tsConfig: {
compilerOptions: {
allowImportingTsExtensions: true,
experimentalDecorators: true,
emitDecoratorMetadata: true
}
}
}
}
MarcusNarcus
MarcusNarcusOP6mo ago
Ah that's why I missed that info, there are two clusters spread far apart talking about TypeScript on that Configuration page, they are not all together in a single clump.
Cue
Cue6mo ago
Navigating the documentation is an art form in itself 😅
Want results from more Discord servers?
Add your server