Skip to content

Commit b5d65fb

Browse files
authored
Bump to 5.5 and update compiler options (#3175)
1 parent 23cec9e commit b5d65fb

File tree

16 files changed

+347
-283
lines changed

16 files changed

+347
-283
lines changed

.changeset/proud-pants-glow.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"@types/eslint": "7.29.0",
3939
"assert": "2.0.0",
4040
"rollup-plugin-typescript2": "0.34.1",
41-
"typescript": "5.4.5",
41+
"typescript": "5.5.3",
4242
"tslib": "^2.6.2",
4343
"prettier": "^2.0.2",
4444
"sharp": "0.28.1"

packages/documentation/copy/en/project-config/Compiler Options.md

Lines changed: 55 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -686,182 +686,204 @@ tsc app.ts util.ts --target esnext --outfile index.js
686686
<p>Include source code in the sourcemaps inside the emitted JavaScript.</p>
687687
</td></tr>
688688

689-
<tr class='odd' name='isolatedModules'>
690-
<td><code><a href='/tsconfig/#isolatedModules'>--isolatedModules</a></code></td>
689+
<tr class='odd' name='isolatedDeclarations'>
690+
<td><code><a href='/tsconfig/#isolatedDeclarations'>--isolatedDeclarations</a></code></td>
691691
<td><p><code>boolean</code></p>
692692
</td>
693693
<td><p><code>false</code></p>
694694
</td>
695695
</tr>
696696
<tr class="option-description odd"><td colspan="3">
697+
<p>Require sufficient annotation on exports so other tools can trivially generate declaration files.</p>
698+
</td></tr>
699+
700+
<tr class='even' name='isolatedModules'>
701+
<td><code><a href='/tsconfig/#isolatedModules'>--isolatedModules</a></code></td>
702+
<td><p><code>boolean</code></p>
703+
</td>
704+
<td><p><code>false</code></p>
705+
</td>
706+
</tr>
707+
<tr class="option-description even"><td colspan="3">
697708
<p>Ensure that each file can be safely transpiled without relying on other imports.</p>
698709
</td></tr>
699710

700-
<tr class='even' name='jsx'>
711+
<tr class='odd' name='jsx'>
701712
<td><code><a href='/tsconfig/#jsx'>--jsx</a></code></td>
702713
<td><p><code>preserve</code>, <code>react</code>, <code>react-native</code>, <code>react-jsx</code>, or <code>react-jsxdev</code></p>
703714
</td>
704715
<td>
705716
</td>
706717
</tr>
707-
<tr class="option-description even"><td colspan="3">
718+
<tr class="option-description odd"><td colspan="3">
708719
<p>Specify what JSX code is generated.</p>
709720
</td></tr>
710721

711-
<tr class='odd' name='jsxFactory'>
722+
<tr class='even' name='jsxFactory'>
712723
<td><code><a href='/tsconfig/#jsxFactory'>--jsxFactory</a></code></td>
713724
<td><p><code>string</code></p>
714725
</td>
715726
<td><p><code>React.createElement</code></p>
716727
</td>
717728
</tr>
718-
<tr class="option-description odd"><td colspan="3">
729+
<tr class="option-description even"><td colspan="3">
719730
<p>Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'.</p>
720731
</td></tr>
721732

722-
<tr class='even' name='jsxFragmentFactory'>
733+
<tr class='odd' name='jsxFragmentFactory'>
723734
<td><code><a href='/tsconfig/#jsxFragmentFactory'>--jsxFragmentFactory</a></code></td>
724735
<td><p><code>string</code></p>
725736
</td>
726737
<td><p><code>React.Fragment</code></p>
727738
</td>
728739
</tr>
729-
<tr class="option-description even"><td colspan="3">
740+
<tr class="option-description odd"><td colspan="3">
730741
<p>Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'.</p>
731742
</td></tr>
732743

733-
<tr class='odd' name='jsxImportSource'>
744+
<tr class='even' name='jsxImportSource'>
734745
<td><code><a href='/tsconfig/#jsxImportSource'>--jsxImportSource</a></code></td>
735746
<td><p><code>string</code></p>
736747
</td>
737748
<td><p><code>react</code></p>
738749
</td>
739750
</tr>
740-
<tr class="option-description odd"><td colspan="3">
751+
<tr class="option-description even"><td colspan="3">
741752
<p>Specify module specifier used to import the JSX factory functions when using <code>jsx: react-jsx*</code>.</p>
742753
</td></tr>
743754

744-
<tr class='even' name='keyofStringsOnly'>
755+
<tr class='odd' name='keyofStringsOnly'>
745756
<td><code><a href='/tsconfig/#keyofStringsOnly'>--keyofStringsOnly</a></code></td>
746757
<td><p><code>boolean</code></p>
747758
</td>
748759
<td><p><code>false</code></p>
749760
</td>
750761
</tr>
751-
<tr class="option-description even"><td colspan="3">
762+
<tr class="option-description odd"><td colspan="3">
752763
<p>Make keyof only return strings instead of string, numbers or symbols. Legacy option.</p>
753764
</td></tr>
754765

755-
<tr class='odd' name='lib'>
766+
<tr class='even' name='lib'>
756767
<td><code><a href='/tsconfig/#lib'>--lib</a></code></td>
757768
<td><p><code>list</code></p>
758769
</td>
759770
<td>
760771
</td>
761772
</tr>
762-
<tr class="option-description odd"><td colspan="3">
773+
<tr class="option-description even"><td colspan="3">
763774
<p>Specify a set of bundled library declaration files that describe the target runtime environment.</p>
764775
</td></tr>
765776

766-
<tr class='even' name='listEmittedFiles'>
777+
<tr class='odd' name='listEmittedFiles'>
767778
<td><code><a href='/tsconfig/#listEmittedFiles'>--listEmittedFiles</a></code></td>
768779
<td><p><code>boolean</code></p>
769780
</td>
770781
<td><p><code>false</code></p>
771782
</td>
772783
</tr>
773-
<tr class="option-description even"><td colspan="3">
784+
<tr class="option-description odd"><td colspan="3">
774785
<p>Print the names of emitted files after a compilation.</p>
775786
</td></tr>
776787

777-
<tr class='odd' name='listFiles'>
788+
<tr class='even' name='listFiles'>
778789
<td><code><a href='/tsconfig/#listFiles'>--listFiles</a></code></td>
779790
<td><p><code>boolean</code></p>
780791
</td>
781792
<td><p><code>false</code></p>
782793
</td>
783794
</tr>
784-
<tr class="option-description odd"><td colspan="3">
795+
<tr class="option-description even"><td colspan="3">
785796
<p>Print all of the files read during the compilation.</p>
786797
</td></tr>
787798

788-
<tr class='even' name='mapRoot'>
799+
<tr class='odd' name='mapRoot'>
789800
<td><code><a href='/tsconfig/#mapRoot'>--mapRoot</a></code></td>
790801
<td><p><code>string</code></p>
791802
</td>
792803
<td>
793804
</td>
794805
</tr>
795-
<tr class="option-description even"><td colspan="3">
806+
<tr class="option-description odd"><td colspan="3">
796807
<p>Specify the location where debugger should locate map files instead of generated locations.</p>
797808
</td></tr>
798809

799-
<tr class='odd' name='maxNodeModuleJsDepth'>
810+
<tr class='even' name='maxNodeModuleJsDepth'>
800811
<td><code><a href='/tsconfig/#maxNodeModuleJsDepth'>--maxNodeModuleJsDepth</a></code></td>
801812
<td><p><code>number</code></p>
802813
</td>
803814
<td><p><code>0</code></p>
804815
</td>
805816
</tr>
806-
<tr class="option-description odd"><td colspan="3">
817+
<tr class="option-description even"><td colspan="3">
807818
<p>Specify the maximum folder depth used for checking JavaScript files from <code>node_modules</code>. Only applicable with <a href="#allowJs"><code>allowJs</code></a>.</p>
808819
</td></tr>
809820

810-
<tr class='even' name='module'>
821+
<tr class='odd' name='module'>
811822
<td><code><a href='/tsconfig/#module'>--module</a></code></td>
812823
<td><p><code>none</code>, <code>commonjs</code>, <code>amd</code>, <code>umd</code>, <code>system</code>, <code>es6</code>/<code>es2015</code>, <code>es2020</code>, <code>es2022</code>, <code>esnext</code>, <code>node16</code>, <code>nodenext</code>, or <code>preserve</code></p>
813824
</td>
814825
<td><p><code>CommonJS</code> if <a href="#target"><code>target</code></a> is <code>ES3</code> or <code>ES5</code>; <code>ES6</code>/<code>ES2015</code> otherwise.</p>
815826
</td>
816827
</tr>
817-
<tr class="option-description even"><td colspan="3">
828+
<tr class="option-description odd"><td colspan="3">
818829
<p>Specify what module code is generated.</p>
819830
</td></tr>
820831

821-
<tr class='odd' name='moduleDetection'>
832+
<tr class='even' name='moduleDetection'>
822833
<td><code><a href='/tsconfig/#moduleDetection'>--moduleDetection</a></code></td>
823834
<td><p><code>legacy</code>, <code>auto</code>, or <code>force</code></p>
824835
</td>
825836
<td><p>"auto": Treat files with imports, exports, import.meta, jsx (with jsx: react-jsx), or esm format (with module: node16+) as modules.</p>
826837
</td>
827838
</tr>
828-
<tr class="option-description odd"><td colspan="3">
839+
<tr class="option-description even"><td colspan="3">
829840
<p>Specify what method is used to detect whether a file is a script or a module.</p>
830841
</td></tr>
831842

832-
<tr class='even' name='moduleResolution'>
843+
<tr class='odd' name='moduleResolution'>
833844
<td><code><a href='/tsconfig/#moduleResolution'>--moduleResolution</a></code></td>
834845
<td><p><code>classic</code>, <code>node10</code>/<code>node</code>, <code>node16</code>, <code>nodenext</code>, or <code>bundler</code></p>
835846
</td>
836847
<td><p><code>Classic</code> if <a href="#module"><code>module</code></a> is <code>AMD</code>, <code>UMD</code>, <code>System</code>, or <code>ES6</code>/<code>ES2015</code>; Matches if <a href="#module"><code>module</code></a> is <code>node16</code> or <code>nodenext</code>; <code>Node</code> otherwise.</p>
837848
</td>
838849
</tr>
839-
<tr class="option-description even"><td colspan="3">
850+
<tr class="option-description odd"><td colspan="3">
840851
<p>Specify how TypeScript looks up a file from a given module specifier.</p>
841852
</td></tr>
842853

843-
<tr class='odd' name='moduleSuffixes'>
854+
<tr class='even' name='moduleSuffixes'>
844855
<td><code><a href='/tsconfig/#moduleSuffixes'>--moduleSuffixes</a></code></td>
845856
<td><p><code>list</code></p>
846857
</td>
847858
<td>
848859
</td>
849860
</tr>
850-
<tr class="option-description odd"><td colspan="3">
861+
<tr class="option-description even"><td colspan="3">
851862
<p>List of file name suffixes to search when resolving a module.</p>
852863
</td></tr>
853864

854-
<tr class='even' name='newLine'>
865+
<tr class='odd' name='newLine'>
855866
<td><code><a href='/tsconfig/#newLine'>--newLine</a></code></td>
856867
<td><p><code>crlf</code> or <code>lf</code></p>
857868
</td>
858869
<td><p><code>lf</code></p>
859870
</td>
860871
</tr>
861-
<tr class="option-description even"><td colspan="3">
872+
<tr class="option-description odd"><td colspan="3">
862873
<p>Set the newline character for emitting files.</p>
863874
</td></tr>
864875

876+
<tr class='even' name='noCheck'>
877+
<td><code><a href='/tsconfig/#noCheck'>--noCheck</a></code></td>
878+
<td><p><code>boolean</code></p>
879+
</td>
880+
<td><p><code>false</code></p>
881+
</td>
882+
</tr>
883+
<tr class="option-description even"><td colspan="3">
884+
<p>Disable full type checking (only critical parse and emit errors will be reported).</p>
885+
</td></tr>
886+
865887
<tr class='odd' name='noEmit'>
866888
<td><code><a href='/tsconfig/#noEmit'>--noEmit</a></code></td>
867889
<td><p><code>boolean</code></p>
@@ -1370,7 +1392,7 @@ tsc app.ts util.ts --target esnext --outfile index.js
13701392

13711393
<tr class='odd' name='target'>
13721394
<td><code><a href='/tsconfig/#target'>--target</a></code></td>
1373-
<td><p><code>es3</code>, <code>es5</code>, <code>es6</code>/<code>es2015</code>, <code>es2016</code>, <code>es2017</code>, <code>es2018</code>, <code>es2019</code>, <code>es2020</code>, <code>es2021</code>, <code>es2022</code>, or <code>esnext</code></p>
1395+
<td><p><code>es3</code>, <code>es5</code>, <code>es6</code>/<code>es2015</code>, <code>es2016</code>, <code>es2017</code>, <code>es2018</code>, <code>es2019</code>, <code>es2020</code>, <code>es2021</code>, <code>es2022</code>, <code>es2023</code>, or <code>esnext</code></p>
13741396
</td>
13751397
<td><p><code>ES3</code></p>
13761398
</td>

packages/sandbox/src/compilerOptions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export const getCompilerOptionsFromParams = (
8585
let toSet = undefined
8686
if (val === "true" && playgroundDefaults[key] !== true) {
8787
toSet = true
88-
} else if (val === "false" && playgroundDefaults[key] !== false) {
88+
} else if (val === "false" && (playgroundDefaults[key] as any) !== false) { // TODO(jakebailey): remove as any, check undefined above
8989
toSet = false
9090
} else if (!isNaN(parseInt(val, 10)) && playgroundDefaults[key] !== parseInt(val, 10)) {
9191
toSet = parseInt(val, 10)

packages/ts-twoslasher/test/results/cuts_out_unnecessary_code.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
],
3434
"staticQuickInfos": [
3535
{
36-
"text": "function createLabel<T extends string | number>(idOrName: T): NameOrId<T>",
36+
"text": "function createLabel<T extends number | string>(idOrName: T): NameOrId<T>",
3737
"docs": "",
3838
"start": 9,
3939
"length": 11,
@@ -42,7 +42,7 @@
4242
"targetString": "createLabel"
4343
},
4444
{
45-
"text": "(type parameter) T in createLabel<T extends string | number>(idOrName: T): NameOrId<T>",
45+
"text": "(type parameter) T in createLabel<T extends number | string>(idOrName: T): NameOrId<T>",
4646
"docs": "",
4747
"start": 21,
4848
"length": 1,
@@ -51,7 +51,7 @@
5151
"targetString": "T"
5252
},
5353
{
54-
"text": "(parameter) idOrName: T extends string | number",
54+
"text": "(parameter) idOrName: T extends number | string",
5555
"docs": "",
5656
"start": 48,
5757
"length": 8,
@@ -60,7 +60,7 @@
6060
"targetString": "idOrName"
6161
},
6262
{
63-
"text": "(type parameter) T in createLabel<T extends string | number>(idOrName: T): NameOrId<T>",
63+
"text": "(type parameter) T in createLabel<T extends number | string>(idOrName: T): NameOrId<T>",
6464
"docs": "",
6565
"start": 58,
6666
"length": 1,
@@ -69,7 +69,7 @@
6969
"targetString": "T"
7070
},
7171
{
72-
"text": "type NameOrId<T extends string | number> = T extends number ? IdLabel : NameLabel",
72+
"text": "type NameOrId<T extends number | string> = T extends number ? IdLabel : NameLabel",
7373
"docs": "",
7474
"start": 62,
7575
"length": 8,
@@ -78,7 +78,7 @@
7878
"targetString": "NameOrId"
7979
},
8080
{
81-
"text": "(type parameter) T in createLabel<T extends string | number>(idOrName: T): NameOrId<T>",
81+
"text": "(type parameter) T in createLabel<T extends number | string>(idOrName: T): NameOrId<T>",
8282
"docs": "",
8383
"start": 71,
8484
"length": 1,
@@ -96,7 +96,7 @@
9696
"targetString": "a"
9797
},
9898
{
99-
"text": "function createLabel<\"typescript\">(idOrName: \"typescript\"): NameLabel",
99+
"text": "function createLabel<\"typescript\">(idOrName: \"typescript\"): NameOrId<\"typescript\">",
100100
"docs": "",
101101
"start": 113,
102102
"length": 11,
@@ -114,7 +114,7 @@
114114
"targetString": "b"
115115
},
116116
{
117-
"text": "function createLabel<2.8>(idOrName: 2.8): IdLabel",
117+
"text": "function createLabel<2.8>(idOrName: 2.8): NameOrId<2.8>",
118118
"docs": "",
119119
"start": 149,
120120
"length": 11,
@@ -132,7 +132,7 @@
132132
"targetString": "c"
133133
},
134134
{
135-
"text": "function createLabel<\"hello\" | 42>(idOrName: \"hello\" | 42): IdLabel | NameLabel",
135+
"text": "function createLabel<\"hello\" | 42>(idOrName: \"hello\" | 42): NameOrId<\"hello\" | 42>",
136136
"docs": "",
137137
"start": 176,
138138
"length": 11,

packages/ts-twoslasher/test/results/errorsWithGenerics.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"targetString": "a"
1515
},
1616
{
17-
"text": "type Record<K extends string | number | symbol, T> = { [P in K]: T; }",
17+
"text": "type Record<K extends keyof any, T> = { [P in K]: T; }",
1818
"docs": "Construct a type with a set of properties K of type T",
1919
"start": 9,
2020
"length": 6,
@@ -32,7 +32,7 @@
3232
"targetString": "b"
3333
},
3434
{
35-
"text": "type Record<K extends string | number | symbol, T> = { [P in K]: T; }",
35+
"text": "type Record<K extends keyof any, T> = { [P in K]: T; }",
3636
"docs": "Construct a type with a set of properties K of type T",
3737
"start": 44,
3838
"length": 6,

packages/ts-twoslasher/test/results/tests/cut_file_errors.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"targetString": "NetworkState"
1515
},
1616
{
17-
"text": "type NetworkLoadingState = {\n state: 'loading';\n}",
17+
"text": "type NetworkLoadingState = {\n state: \"loading\";\n}",
1818
"docs": "",
1919
"start": 20,
2020
"length": 19,
@@ -23,7 +23,7 @@
2323
"targetString": "NetworkLoadingState"
2424
},
2525
{
26-
"text": "type NetworkFailedState = {\n state: 'failed';\n code: number;\n}",
26+
"text": "type NetworkFailedState = {\n state: \"failed\";\n code: number;\n}",
2727
"docs": "",
2828
"start": 42,
2929
"length": 18,
@@ -32,7 +32,7 @@
3232
"targetString": "NetworkFailedState"
3333
},
3434
{
35-
"text": "type NetworkSuccessState = {\n state: 'success';\n response: {\n title: string;\n duration: number;\n summary: string;\n };\n}",
35+
"text": "type NetworkSuccessState = {\n state: \"success\";\n response: {\n title: string;\n duration: number;\n summary: string;\n };\n}",
3636
"docs": "",
3737
"start": 63,
3838
"length": 19,

0 commit comments

Comments
 (0)