From 8d1bcd8aeb08afafc8a3a2b9b2bc6ceb6c7dff0d Mon Sep 17 00:00:00 2001 From: Jakub Piasecki Date: Fri, 6 Jun 2025 00:29:36 -0700 Subject: [PATCH] Update Typescript version (#51831) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/51831 Changelog: [Internal] Reviewed By: robhogan Differential Revision: D76018604 fbshipit-source-id: b16be849d155d608306a8778cea540f0096a66b0 --- flow-typed/npm/typescript_v5.x.x.js | 5 +++++ package.json | 2 +- scripts/build/build.js | 8 +++++++- yarn.lock | 10 +++++----- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/flow-typed/npm/typescript_v5.x.x.js b/flow-typed/npm/typescript_v5.x.x.js index 683b8589bf6..3e5efa0afc6 100644 --- a/flow-typed/npm/typescript_v5.x.x.js +++ b/flow-typed/npm/typescript_v5.x.x.js @@ -48,6 +48,11 @@ declare module 'typescript' { file: SourceFile, start?: number, ): $ReadOnly<{line: number, character: number}>, + convertCompilerOptionsFromJson( + jsonOptions: any, + basePath: string, + configFileName?: string, + ): {options: Object, errors: Diagnostic[]}, ModuleResolutionKind: typeof ModuleResolutionKind, ... }; diff --git a/package.json b/package.json index 7c577ae0cd6..dd1480b9a19 100644 --- a/package.json +++ b/package.json @@ -108,7 +108,7 @@ "supports-color": "^7.1.0", "temp-dir": "^2.0.0", "tinybench": "^3.1.0", - "typescript": "5.0.4", + "typescript": "5.8.3", "ws": "^6.2.3" }, "resolutions": { diff --git a/scripts/build/build.js b/scripts/build/build.js index 0472d14c521..ada75b709b5 100644 --- a/scripts/build/build.js +++ b/scripts/build/build.js @@ -432,7 +432,13 @@ function validateTypeScriptDefs(packageName /*: string */) { noEmit: true, skipLibCheck: false, }; - const program = ts.createProgram(files, compilerOptions); + const program = ts.createProgram( + files, + ts.convertCompilerOptionsFromJson( + compilerOptions, + path.resolve(PACKAGES_DIR, packageName), + ), + ); const emitResult = program.emit(); if (emitResult.diagnostics.length) { diff --git a/yarn.lock b/yarn.lock index 410a1d905c8..69b9dd43ffc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8613,11 +8613,6 @@ typed-array-length@^1.0.6: is-typed-array "^1.1.13" possible-typed-array-names "^1.0.0" -typescript@5.0.4: - version "5.0.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.4.tgz#b217fd20119bd61a94d4011274e0ab369058da3b" - integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw== - typescript@5.3.2: version "5.3.2" resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.3.2.tgz#00d1c7c1c46928c5845c1ee8d0cc2791031d4c43" @@ -8628,6 +8623,11 @@ typescript@5.8.2: resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.8.2.tgz#8170b3702f74b79db2e5a96207c15e65807999e4" integrity sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ== +typescript@5.8.3: + version "5.8.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.8.3.tgz#92f8a3e5e3cf497356f4178c34cd65a7f5e8440e" + integrity sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ== + uc.micro@^2.0.0, uc.micro@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-2.1.0.tgz#f8d3f7d0ec4c3dea35a7e3c8efa4cb8b45c9e7ee"