1414
1515** Table of Contents**
1616
17- - [ Installation] ( #installation )
18- - [ Usage] ( #usage )
19- - [ Base] ( #base )
20- - [ Extra Strict] ( #extra-strict )
21- - [ Decorators] ( #decorators )
22- - [ Verbatim] ( #verbatim )
23- - [ Bundler] ( #bundler )
24- - [ Buy us some doughnuts] ( #buy-us-some-doughnuts )
25- - [ Contributors] ( #contributors )
17+ - [ Installation] ( #installation )
18+ - [ Usage] ( #usage )
19+ - [ Base] ( #base )
20+ - [ Extra Strict] ( #extra-strict )
21+ - [ Decorators] ( #decorators )
22+ - [ Verbatim] ( #verbatim )
23+ - [ Bundler] ( #bundler )
24+ - [ Buy us some doughnuts] ( #buy-us-some-doughnuts )
25+ - [ Contributors] ( #contributors )
2626
2727## Installation
2828
@@ -39,24 +39,24 @@ npm install --save-dev @sapphire/ts-config
3939This package ships a couple of different sets of tsconfig, they should be used in an array of
4040` extends ` in your ` tsconfig.json ` file. The supported configs are:
4141
42- - ` @sapphire/ts-config/base ` -> This is identical to ` @sapphire/ts-config `
43- - ` @sapphire/ts-config/extra-strict `
44- - ` @sapphire/ts-config/decorators `
45- - ` @sapphire/ts-config/verbatim `
42+ - ` @sapphire/ts-config/base ` -> This is identical to ` @sapphire/ts-config `
43+ - ` @sapphire/ts-config/extra-strict `
44+ - ` @sapphire/ts-config/decorators `
45+ - ` @sapphire/ts-config/verbatim `
4646
4747You should always start with the base config, regardless of what other configs you choose.
4848Next you can opt-in to the other configs.
4949
5050Finally you should configure your package.json properly based on what kind of package you are writing
5151
52- - For CJS packages you should add ` "type": "commonjs" ` to your ` package.json `
53- - For ESM packages you should add ` "type": "module" ` to your ` package.json `
54- - For a package that is going to be used by both CJS and ESM then you should not add any ` "type" ` to your ` package.json `
55- - Note that if you intend to compile for both your best option is to compile
56- for CJS from TypeScript, then use [ ` gen-esm-wrapper ` ] ( https://github.com/addaleax/gen-esm-wrapper ) to transform your
57- input file to ESM compatible exports. This is also what we do for our Sapphire packages.
58- - Note also that in this case you should not enable ` @sapphire/ts-config/verbatim ` , because it will not work without
59- a ` "type" ` specified in ` package.json `
52+ - For CJS packages you should add ` "type": "commonjs" ` to your ` package.json `
53+ - For ESM packages you should add ` "type": "module" ` to your ` package.json `
54+ - For a package that is going to be used by both CJS and ESM then you should not add any ` "type" ` to your ` package.json `
55+ - Note that if you intend to compile for both your best option is to compile
56+ for CJS from TypeScript, then use [ ` gen-esm-wrapper ` ] ( https://github.com/addaleax/gen-esm-wrapper ) to transform your
57+ input file to ESM compatible exports. This is also what we do for our Sapphire packages.
58+ - Note also that in this case you should not enable ` @sapphire/ts-config/verbatim ` , because it will not work without
59+ a ` "type" ` specified in ` package.json `
6060
6161Next we will go over the different configs and what they do.
6262
@@ -65,18 +65,18 @@ Next we will go over the different configs and what they do.
6565The base config (` @sapphire/ts-config ` , or ` @sapphire/ts-config/base ` ) is the default config with options set up in
6666such a way that it will suite nearly all projects.
6767
68- You can view the content of this tsconfig [ here] ( https://github.com/sapphiredev/utilities/blob/main/packages/ts-config/tsconfig.json )
68+ You can view the content of this tsconfig [ here] ( https://github.com/sapphiredev/utilities/blob/main/packages/ts-config/src/ tsconfig.json )
6969
7070### Extra Strict
7171
7272You should include this config if you want to extra strict checking. This configures the following compiler options:
7373
74- - [ ` allowUnreachableCode ` to ` false ` ] ( https://www.typescriptlang.org/tsconfig#allowUnreachableCode )
75- - [ ` allowUnusedLabels ` to ` false ` ] ( https://www.typescriptlang.org/tsconfig#allowUnusedLabels )
76- - [ ` exactOptionalPropertyTypes ` to ` false ` ] ( https://www.typescriptlang.org/tsconfig#exactOptionalPropertyTypes )
77- - [ ` noImplicitOverride ` to ` true ` ] ( https://www.typescriptlang.org/tsconfig#noImplicitOverride )
74+ - [ ` allowUnreachableCode ` to ` false ` ] ( https://www.typescriptlang.org/tsconfig#allowUnreachableCode )
75+ - [ ` allowUnusedLabels ` to ` false ` ] ( https://www.typescriptlang.org/tsconfig#allowUnusedLabels )
76+ - [ ` exactOptionalPropertyTypes ` to ` false ` ] ( https://www.typescriptlang.org/tsconfig#exactOptionalPropertyTypes )
77+ - [ ` noImplicitOverride ` to ` true ` ] ( https://www.typescriptlang.org/tsconfig#noImplicitOverride )
7878
79- You can view the content of this tsconfig [ here] ( https://github.com/sapphiredev/utilities/blob/main/packages/ts-config/extra-strict.json )
79+ You can view the content of this tsconfig [ here] ( https://github.com/sapphiredev/utilities/blob/main/packages/ts-config/src/ extra-strict.json )
8080
8181### Decorators
8282
@@ -87,10 +87,10 @@ you are using decorators. Packages such as `@sapphire/decorators` rely on this c
8787
8888This enables the following compiler options:
8989
90- - [ experimentalDecorators] ( https://www.typescriptlang.org/tsconfig#experimentalDecorators )
91- - [ emitDecoratorMetadata] ( https://www.typescriptlang.org/tsconfig#emitDecoratorMetadata )
90+ - [ experimentalDecorators] ( https://www.typescriptlang.org/tsconfig#experimentalDecorators )
91+ - [ emitDecoratorMetadata] ( https://www.typescriptlang.org/tsconfig#emitDecoratorMetadata )
9292
93- You can view the content of this tsconfig [ here] ( https://github.com/sapphiredev/utilities/blob/main/packages/ts-config//decorators.json )
93+ You can view the content of this tsconfig [ here] ( https://github.com/sapphiredev/utilities/blob/main/packages/ts-config/src /decorators.json )
9494
9595### Verbatim
9696
@@ -101,9 +101,9 @@ See the TypeScript documentation for more information.
101101
102102This enables the following compiler options:
103103
104- - [ verbatimModuleSyntax] ( https://www.typescriptlang.org/tsconfig#verbatimModuleSyntax )
104+ - [ verbatimModuleSyntax] ( https://www.typescriptlang.org/tsconfig#verbatimModuleSyntax )
105105
106- You can view the content of this tsconfig [ here] ( https://github.com/sapphiredev/utilities/blob/main/packages/ts-config/verbatim.json )
106+ You can view the content of this tsconfig [ here] ( https://github.com/sapphiredev/utilities/blob/main/packages/ts-config/src/ verbatim.json )
107107
108108### Bundler
109109
@@ -113,10 +113,10 @@ config sets [`moduleResolution` to `Bundler`][moduleResolution] and [`module` to
113113
114114This configures the following compiler options:
115115
116- - [ ` moduleResolution ` to ` Bundler ` ] [ moduleResolution ]
117- - [ ` module ` to ` ES2022 ` ] [ module ]
116+ - [ ` moduleResolution ` to ` Bundler ` ] [ moduleResolution ]
117+ - [ ` module ` to ` ES2022 ` ] [ module ]
118118
119- You can view the content of this tsconfig [ here] ( https://github.com/sapphiredev/utilities/blob/main/packages/ts-config/bundler.json )
119+ You can view the content of this tsconfig [ here] ( https://github.com/sapphiredev/utilities/blob/main/packages/ts-config/src/ bundler.json )
120120
121121## Buy us some doughnuts
122122
0 commit comments