Skip to content

Commit 8b794ad

Browse files
committed
chore: opt-in to @typescript/native-preview
1 parent 16f7d4c commit 8b794ad

10 files changed

Lines changed: 185 additions & 70 deletions

File tree

packages/app/example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"@rnx-kit/cli": "^0.18.11",
3838
"@rnx-kit/metro-config": "^2.2.3",
3939
"@rnx-kit/polyfills": "^0.2.0",
40-
"@rnx-kit/tsconfig": "^2.0.0",
40+
"@rnx-kit/tsconfig": "^3.0.0",
4141
"@types/react": "~19.1.0",
4242
"@wdio/types": "^9.20.0",
4343
"appium": "^3.1.1",

packages/app/example/test/specs/wdio.config.mjs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
import { spawnSync } from "node:child_process";
33
import * as fs from "node:fs";
44

5-
/** @typedef {import("@wdio/types").Capabilities.WebdriverIOConfig["logLevel"]} LogLevel */
6-
/** @typedef {import("@wdio/types").Options.Testrunner["runner"]} Runner */
7-
85
function getAvailableSimulators(search = "iPhone") {
96
const { error, status, stderr, stdout } = spawnSync(
107
"xcrun",
@@ -112,7 +109,7 @@ const findLatestIPhoneSimulator = (() => {
112109
})();
113110

114111
export const config = {
115-
runner: /** @type {Runner} */ ("local"),
112+
runner: /** @type {const} */ ("local"),
116113
port: 4723,
117114
specs: ["**/*.spec.js"],
118115
capabilities: (() => {
@@ -150,7 +147,7 @@ export const config = {
150147
throw new Error(`Unknown platform: ${targetPlatform}`);
151148
}
152149
})(),
153-
logLevel: /** @type {LogLevel} */ ("info"),
150+
logLevel: /** @type {const} */ ("info"),
154151
waitforTimeout: 60000,
155152
specFileRetries: 3,
156153
};

packages/app/example/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"compilerOptions": {
44
"jsx": "react-native",
55
"noEmit": true,
6-
"lib": ["ES2021", "DOM"]
6+
"lib": ["ES2022", "DOM"]
77
},
88
"include": [
99
"index.ts",

packages/app/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"generate:code": "node scripts/internal/generate-manifest.mts",
7474
"generate:docs": "node scripts/internal/generate-manifest-docs.mts",
7575
"generate:schema": "node scripts/internal/generate-schema.mts",
76-
"lint:js": "eslint $(git ls-files '*.[cm][jt]s' '*.[jt]s' '*.tsx' ':!:*.config.js' ':!:.yarn/releases') && tsc && tsc --project tsconfig.cjs.json",
76+
"lint:js": "eslint $(git ls-files '*.[cm][jt]s' '*.[jt]s' '*.tsx' ':!:*.config.js' ':!:.yarn/releases') && tsgo && tsgo --project tsconfig.cjs.json",
7777
"lint:kt": "ktlint --relative 'android/app/src/**/*.kt'",
7878
"lint:rb": "bundle exec rubocop",
7979
"lint:swift": "swiftlint",
@@ -120,15 +120,15 @@
120120
"devDependencies": {
121121
"@babel/core": "^7.25.2",
122122
"@babel/preset-env": "^7.25.3",
123-
"@expo/config-plugins": "^10.0.0",
123+
"@expo/config-plugins": "^54.0.0",
124124
"@expo/json-file": "~9.1.5",
125125
"@microsoft/eslint-plugin-sdl": "^1.0.0",
126126
"@react-native-community/cli": "^20.0.0",
127127
"@react-native-community/cli-types": "^20.0.0",
128128
"@react-native-community/template": "^0.81.0",
129129
"@rnx-kit/eslint-plugin": "^0.9.0",
130130
"@rnx-kit/lint-lockfile": "^0.1.0",
131-
"@rnx-kit/tsconfig": "^2.0.0",
131+
"@rnx-kit/tsconfig": "^3.0.0",
132132
"@swc-node/register": "^1.10.0",
133133
"@swc/core": "^1.11.0",
134134
"@types/js-yaml": "^4.0.5",
@@ -137,6 +137,7 @@
137137
"@types/prompts": "~2.4.0",
138138
"@types/react": "~19.1.0",
139139
"@types/semver": "^7.3.6",
140+
"@typescript/native-preview": "^7.0.0-0",
140141
"eslint": "^9.12.0",
141142
"eslint-plugin-wdio": "^9.0.0",
142143
"js-yaml": "^4.1.0",
@@ -148,8 +149,7 @@
148149
"react-native": "^0.81.0",
149150
"react-native-macos": "^0.81.1",
150151
"react-native-windows": "^0.81.0",
151-
"suggestion-bot": "^4.0.0",
152-
"typescript": "^5.0.0"
152+
"suggestion-bot": "^4.0.0"
153153
},
154154
"engines": {
155155
"node": ">=18.12"

packages/app/scripts/config-plugins/plugins/mod-compiler.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
// @ts-check
2+
/** @import { ExportedConfig } from "@expo/config-plugins"; */
23
import { BaseMods, evalModsAsync } from "../ExpoConfigPlugins.mjs";
34
import { getAndroidModFileProviders } from "./withAndroidBaseMods.mjs";
45
import { getIosModFileProviders } from "./withIosBaseMods.mjs";
56
import { getMacOsModFileProviders } from "./withMacOsBaseMods.mjs";
67

7-
/** @type {import("@expo/config-plugins").withDefaultBaseMods} */
8+
/** @type {(config: ExportedConfig, props?: Record<string, unknown>) => ExportedConfig} */
89
export const withDefaultBaseMods = (config, props) => {
910
config = BaseMods.withIosBaseMods(config, {
1011
...props,
@@ -23,7 +24,7 @@ export const withDefaultBaseMods = (config, props) => {
2324
return config;
2425
};
2526

26-
/** @type {import("@expo/config-plugins").compileModsAsync} */
27+
/** @type {typeof evalModsAsync} */
2728
export const compileModsAsync = (config, props) => {
2829
if (props.introspect === true) {
2930
console.warn("`introspect` is not supported by react-native-test-app");

packages/app/scripts/init.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,9 @@ function instructionsFor(platform) {
164164
throw new Error(`Unknown platform: ${platform}`);
165165
}
166166

167+
/**
168+
* @returns {Promise<number>}
169+
*/
167170
function main() {
168171
return new Promise((resolve) => {
169172
parseArgs(

packages/app/scripts/schema.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { URL, fileURLToPath } from "node:url";
33
import { readJSONFile } from "./helpers.js";
44

5-
/** @typedef {import("./types.js").Docs} Docs */
5+
/** @import { Docs } from "./types.ts"; */
66

77
/**
88
* @param {string} content
@@ -16,7 +16,9 @@ function extractBrief(content = "") {
1616

1717
function readManifest() {
1818
const manifest = fileURLToPath(new URL("../package.json", import.meta.url));
19-
return /** @type {import("../package.json")} */ (readJSONFile(manifest));
19+
return /** @type {typeof import("../package.json")} */ (
20+
readJSONFile(manifest)
21+
);
2022
}
2123

2224
/**

packages/app/test/helpers.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type Mustache from "mustache";
12
import { equal, fail, notEqual } from "node:assert/strict";
23
import * as fs from "node:fs";
34
import * as path from "node:path";
@@ -56,7 +57,7 @@ describe("getPackageVersion()", () => {
5657

5758
describe("requireTransitive()", () => {
5859
it("imports transitive dependencies", () => {
59-
const mustache = requireTransitive<typeof import("mustache")>([
60+
const mustache = requireTransitive<typeof Mustache>([
6061
"react-native-windows",
6162
"@react-native-windows/cli",
6263
"mustache",
@@ -71,7 +72,7 @@ describe("requireTransitive()", () => {
7172
fail("Failed to resolve 'react-native-windows'");
7273
}
7374

74-
const mustache = requireTransitive<typeof import("mustache")>(
75+
const mustache = requireTransitive<typeof Mustache>(
7576
["@react-native-windows/cli", "mustache"],
7677
fs.realpathSync(rnwDir)
7778
);

packages/app/windows/app.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ export async function generateSolution(destPath, options, fs = nodefs) {
200200
.map((project) => toProjectEntry(project, destPath))
201201
.join(os.EOL);
202202

203-
/** @type {typeof import("mustache")} */
203+
/** @type {typeof import("mustache").default} */
204204
const mustache = requireTransitive(
205205
["@react-native-windows/cli", "mustache"],
206206
fs.realpathSync(rnWindowsPath)

0 commit comments

Comments
 (0)