-
Notifications
You must be signed in to change notification settings - Fork 28.5k
Upgrade TypeScript to v5.5.2 #67113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade TypeScript to v5.5.2 #67113
Changes from all commits
fd1f5ef
f7445e5
a456e3d
c2a8479
4ee44e4
0dfa7fa
6e6837e
da4fbb5
03f2cb0
c93226a
61a0ced
a8ba53a
8efa2bf
dc7d3aa
119df0b
4b3f42f
9dc01de
62bcb9f
d19a4f8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -321,7 +321,7 @@ | |
"util": "0.12.4", | ||
"vm-browserify": "1.1.2", | ||
"watchpack": "2.4.0", | ||
"web-vitals": "3.0.0", | ||
"web-vitals": "4.2.1", | ||
"webpack": "5.90.0", | ||
"webpack-sources1": "npm:[email protected]", | ||
"webpack-sources3": "npm:[email protected]", | ||
|
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2589,10 +2589,7 @@ export async function diagnostics(task, opts) { | |
} | ||
|
||
export async function build(task, opts) { | ||
await task.serial( | ||
['precompile', 'compile', 'generate_types', 'rewrite_compiled_references'], | ||
opts | ||
) | ||
await task.serial(['precompile', 'compile', 'generate_types'], opts) | ||
} | ||
|
||
export async function generate_types(task, opts) { | ||
|
@@ -2601,37 +2598,6 @@ export async function generate_types(task, opts) { | |
}) | ||
} | ||
|
||
/** | ||
* TypeScript will emit references to the compiled types used to type the implementation. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TypeScript no longer does that? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Took a good amount of time to debug from error caused by this 😅, TS didn't generate Currently looking for a backup docs about why, but for now found on the PR:
|
||
* The declarations however don't need such detailed types. | ||
* We rewrite the references to reference a more lightweight solution instead. | ||
* @param {import('taskr').Task} task | ||
*/ | ||
export async function rewrite_compiled_references(task, opts) { | ||
const declarationDirectory = join(__dirname, 'dist') | ||
const declarationFiles = glob.sync('**/*.d.ts', { cwd: declarationDirectory }) | ||
|
||
for (const declarationFile of declarationFiles) { | ||
const content = await fs.readFile( | ||
join(declarationDirectory, declarationFile), | ||
'utf8' | ||
) | ||
// Rewrite | ||
// /// <reference path="../../../../types/$$compiled.internal.d.ts" /> | ||
// to | ||
// /// <reference path="../../../../types/compiled.d.ts" /> | ||
if (content.indexOf('/types/$$compiled.internal.d.ts" />') !== -1) { | ||
await fs.writeFile( | ||
join(declarationDirectory, declarationFile), | ||
content.replace( | ||
/\/types\/\$\$compiled\.internal\.d\.ts" \/>/g, | ||
'/types/compiled.d.ts" />' | ||
) | ||
) | ||
} | ||
} | ||
} | ||
|
||
export default async function (task) { | ||
const opts = { dev: true } | ||
await task.clear('dist') | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,13 +2,13 @@ | |
"extends": "../../tsconfig-tsec.json", | ||
"compilerOptions": { | ||
"strict": true, | ||
"module": "esnext", | ||
"target": "ES2017", | ||
"stripInternal": true, | ||
"esModuleInterop": true, | ||
"moduleResolution": "node", | ||
"verbatimModuleSyntax": true, | ||
"jsx": "react-jsx", | ||
"stripInternal": true, | ||
"verbatimModuleSyntax": true | ||
"module": "ESNext", | ||
"target": "ES2018", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
"moduleResolution": "node" | ||
}, | ||
"exclude": [ | ||
"dist", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,2 @@ | ||
// Triple slash directives are copied from src/types.ts. | ||
// TypeScript currently does not preserve the tripple-slash directives. | ||
// Once https://github.com/microsoft/TypeScript/pull/57681 is released, we can remove the triple slash directives here. | ||
/// <reference types="react" /> | ||
/// <reference types="react/experimental" /> | ||
/// <reference types="react-dom" /> | ||
/// <reference types="react-dom/experimental" /> | ||
export * from './dist/types' | ||
export { default } from './dist/types' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use preserve true to prevent it removed.
x-ref:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was looking for something like this the last time. Nice find 👍🏻 The TS team is not the only team missing docs 😄