Repository navigation
Description
Before submitting a new issue
- I tested using the latest version of the library, as the bug might be already fixed.
- I tested using a supported version of react native.
- I checked for possible duplicate issues, with possible answers.
Bug summary
tsconfig.json sets noImplicitUseStrict and noStrictGenericChecks, which TypeScript 7 no longer has, and src/native/styles/variables.ts indexes variables by a string after if (name in variables), where TypeScript 7 reads its type as { [VAR_SYMBOL]: true }. tsc --noEmit -p tsconfig.json passes with the pinned 6.0.3 and reports four errors with 7.0.2, npm's latest for typescript.
#391, #501 and #503 rewrite that lookup, and their heads report only the two options under 7.0.2; #412's head reports TS7053 three times there.
Library version
main at df32ce3
Environment info
System:
OS: Windows 11 10.0.26300
CPU: "(32) x64 AMD Ryzen 9 9950X3D 16-Core Processor "
Memory: 160.57 GB / 255.67 GB
Binaries:
Node:
version: 26.12.1
path: C:\Program Files\nodejs\node.EXE
Yarn:
version: 4.9.2
path: C:\Users\<user>\AppData\Roaming\npm\yarn.CMD
npm:
version: 12.2.1
path: C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK:
AllowDevelopmentWithoutDevLicense: Enabled
Versions:
- 10.0.19041.0
- 10.0.26100.0
IDEs:
Android Studio: AI-262.9437.185.2621.16467767
Visual Studio: Not Found
Languages:
Java:
version: 17.0.20.1
path: C:\Program Files\Microsoft\jdk-17.0.20.101-hotspot\bin\javac.EXE
Ruby: Not Found
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 19.2.3
wanted: 19.2.3
react-native:
installed: 0.86.3
wanted: 0.86.3
react-native-windows: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: Not found
newArchEnabled: Not found
iOS:
hermesEnabled: Not found
newArchEnabled: Not foundSteps to reproduce
- Clone the reproducer branch, which is
mainat df32ce3 with one file added,reproduce.sh:git clone --branch repro/typescript-7-typecheck https://github.com/YevheniiKotyrlo/react-native-css cd react-native-css - Run
./reproduce.sh. It runsyarn install --immutable, thentsc --noEmit -p tsconfig.jsonwith the pinned TypeScript and with TypeScript 7.0.2 throughnpx, and ends with one line:DEFECT: …and exit status 1 while 7.0.2 reports these errors and no other,FIXED: …and 0 once it passes,ERROR: …and 2 when the install fails, the pinned TypeScript fails too,npxcannot run 7.0.2, or 7.0.2 reports another error.
reproduce.sh:
#!/usr/bin/env bash
# Runs the repository's own type check, tsc --noEmit -p tsconfig.json, under its pinned TypeScript and then under TypeScript 7.0.2.
# Exits 1 while TypeScript 7.0.2 reports the defect's errors and no other, 0 once it passes, and 2 when a step before the check
# fails, the pinned TypeScript fails too, or TypeScript 7.0.2 reports another error.
set -uo pipefail
latest=7.0.2
# The defect's errors: two options TypeScript 7 no longer knows, and an index into a variable map TypeScript 7 refuses
options_error="error TS5023: Unknown compiler option '(noImplicitUseStrict|noStrictGenericChecks)'\."
index_error="^src/native/styles/variables\.ts\([0-9]+,[0-9]+\): error TS7053: "
verdict() {
printf '%s\n' "$2"
exit "$1"
}
system=$(uname -sr) || verdict 2 "ERROR: uname failed"
node_version=$(node --version) || verdict 2 "ERROR: node is not on PATH"
yarn_version=$(yarn --version) || verdict 2 "ERROR: yarn is not on PATH"
revision=$(git rev-parse --short HEAD) || verdict 2 "ERROR: this is not a git checkout"
echo "System: $system, Node $node_version, Yarn $yarn_version, react-native-css $revision"
if ! install_output=$(yarn install --immutable 2>&1); then
printf '%s\n' "$install_output" | tail -n 15
verdict 2 "ERROR: yarn install --immutable failed, so no type check ran"
fi
echo "yarn install --immutable: done"
pinned=$(yarn tsc --version) || verdict 2 "ERROR: the pinned tsc does not start"
pinned=${pinned#Version }
if ! pinned_output=$(yarn tsc --noEmit -p tsconfig.json 2>&1); then
printf '%s\n' "$pinned_output"
verdict 2 "ERROR: the pinned TypeScript $pinned fails the type check too, so it is not TypeScript $latest that fails it"
fi
echo "TypeScript $pinned: tsc --noEmit -p tsconfig.json exits 0"
latest_version=$(npx --yes -p "typescript@$latest" tsc --version) || verdict 2 "ERROR: npx could not run TypeScript $latest"
latest_output=$(npx --yes -p "typescript@$latest" tsc --noEmit -p tsconfig.json 2>&1)
latest_status=$?
printf '%s\n' "$latest_output"
echo "TypeScript ${latest_version#Version }: tsc --noEmit -p tsconfig.json exits $latest_status"
if [ "$latest_status" -eq 0 ]; then
verdict 0 "FIXED: TypeScript $latest passes the type check, as TypeScript $pinned does"
fi
errors=$(grep -c -E 'error TS[0-9]+' <<< "$latest_output")
options=$(grep -c -E "$options_error" <<< "$latest_output")
indexes=$(grep -c -E "$index_error" <<< "$latest_output")
if [ "$errors" -eq 0 ]; then
verdict 2 "ERROR: TypeScript $latest exited $latest_status without an error line"
fi
others=$((errors - options - indexes))
if [ "$others" -gt 0 ]; then
verdict 2 "ERROR: TypeScript $latest reports $others errors besides the defect's"
fi
verdict 1 "DEFECT: TypeScript $latest fails the type check TypeScript $pinned passes: $options errors for options it no longer knows (TS5023) and $indexes for an index into a variable map in src/native/styles/variables.ts (TS7053)"Expected: both type checks exit 0: TypeScript 7.0.2 passes, and the pinned 6.0.3 still does. The script ends with FIXED: TypeScript 7.0.2 passes the type check, as TypeScript 6.0.3 does and exits 0.
Actual: 6.0.3 exits 0; 7.0.2 reports four errors and exits 1, and the script ends with this line and exits 1:
DEFECT: TypeScript 7.0.2 fails the type check TypeScript 6.0.3 passes: 2 errors for options it no longer knows (TS5023) and 2 for an index into a variable map in src/native/styles/variables.ts (TS7053)
The run's output on main at df32ce3, Windows 11, Node 26.12.1
System: MINGW64_NT-10.0-26300 3.6.10-5a1665c8.x86_64, Node v26.12.1, Yarn 4.9.2, react-native-css c1f9723
yarn install --immutable: done
TypeScript 6.0.3: tsc --noEmit -p tsconfig.json exits 0
src/native/styles/variables.ts(81,38): error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{ [VAR_SYMBOL]: true; }'.
No index signature with a parameter of type 'string' was found on type '{ [VAR_SYMBOL]: true; }'.
src/native/styles/variables.ts(82,23): error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{ [VAR_SYMBOL]: true; }'.
No index signature with a parameter of type 'string' was found on type '{ [VAR_SYMBOL]: true; }'.
tsconfig.json(30,5): error TS5023: Unknown compiler option 'noImplicitUseStrict'.
tsconfig.json(31,5): error TS5023: Unknown compiler option 'noStrictGenericChecks'.
TypeScript 7.0.2: tsc --noEmit -p tsconfig.json exits 1
DEFECT: TypeScript 7.0.2 fails the type check TypeScript 6.0.3 passes: 2 errors for options it no longer knows (TS5023) and 2 for an index into a variable map in src/native/styles/variables.ts (TS7053)
Reproducible example repository
https://github.com/YevheniiKotyrlo/react-native-css/tree/repro/typescript-7-typecheck
Activity