Files
azure-sdk-for-js/tsconfig.browser.base.json
c4de0e1f66 chore(core): add react-native and @types/react devDependencies (#38135)
Add `react-native` and `@types/react` as devDependencies to all 14 core
packages. Required for type-checking the react-native build target.

## Additional fixes

**`tsconfig.browser.base.json`** — Exclude `src/**/*-react-native.*`
from browser test compilation. Without this, `tsc` picks up react-native
platform files (e.g. `runtimeInfo-react-native.mts`) which `import
"react-native"`, pulling in globals that conflict with DOM types.

**`core-amqp/src/util/utils.ts`** — Change `_timer` type from
`ReturnType<typeof setTimeout>` to `number | NodeJS.Timeout`. The root
`tsconfig.src.react-native.json` inherits `types: ["node"]` from
`tsconfig.src.build.json`, so both `@types/node` and react-native
globals are in scope. React-native overrides `setTimeout` to return
`number` while `@types/node` returns `NodeJS.Timeout`, and the local
`class Timeout` shadows the type name, causing a conflict. This is
resolved properly in the `#platform/*` migration where the react-native
tsconfig uses `types: ["react-native"]` only.

---------

Co-authored-by: Copilot <[email protected]>
2026-04-14 13:42:05 -07:00

25 lines
876 B
JSON

{
"extends": ["./tsconfig.json", "./tsconfig.nonlib.json"],
"compilerOptions": {
"lib": ["DOM", "DOM.Iterable", "ESNext"],
// Workaround for browser build-test:
// - Some core and storage package have mixed usage of NodeJS and browser types in same file.
// - TypeScript resolves our types from ESM because of `"moduleResolution": "NodeNext"`
// and some files have code similar to `import { ... } from "node:xxx";`
"types": ["node"],
"outDir": "${configDir}/dist-test/browser",
"noEmit": false,
"paths": {
"$internal/*": ["./dist/browser/*"]
}
},
"include": ["${configDir}/src", "${configDir}/test"],
"exclude": [
"${configDir}/src/**/*-react-native.*",
"${configDir}/test/**/node",
"${configDir}/test/**/react-native",
"${configDir}/test/stress",
"${configDir}/test/snippets.spec.ts"
]
}