react-strict-dom
react-strict-dom copied to clipboard
Typescript: Module '"react-strict-dom"' has no exported member 'compat'.
Describe the issue
compat is documented here, but it does not have a Typescript definition.
Expected behavior
Typescript definition for compat is available
Steps to reproduce
- Clone https://github.com/davidjbng/react-strict-dom-compat-ts
-
npm install -
npm run typecheck
Test case
https://github.com/davidjbng/react-strict-dom-compat-ts
Additional comments
No response
The types are there, but the API is only exported for native. I'll update the docs to make that clear
Custom conditions can be resolved using "customConditions", and platform extensions using "moduleSuffixes" option in TypeScript.
In this case adding "customConditions" seems to fix the missing compat types.
{
"compilerOptions": {
"customConditions": ["react-native"],
"moduleSuffixes": [".ios", ".android", ".native", ""]
},
}
ref:
- https://www.typescriptlang.org/tsconfig/#customConditions
- https://www.typescriptlang.org/tsconfig/#moduleSuffixes
This is being added to the docs in https://github.com/facebook/react-strict-dom/pull/315