useGlobal() does not compile using TypeScript - Throws TS2345 Error
See original GitHub issueI need to use @ts-ignore
to get this to compile
import React, {useGlobal, setGlobal} from 'reactn';
function foo() {
setGlobal({bar: 'test'});
// @ts-ignore TS2345: Argument of type '"bar"' is not assignable to parameter of type 'never'.
const [ bar ] = useGlobal('bar');
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
typescript compile error #3551 - ethers-io/ethers.js - GitHub
node_modules/@ethersproject/abstract-provider/src.ts/index.ts:251:13 - error TS2322: Type 'BigNumber' is not assignable to type 'null'.
Read more >Error: TSError: Unable to compile TypeScript - Stack Overflow
I had met same issue. First I remove ts-node and typescript from package.json . then, npm install ts-node --save-dev npm install typescript ......
Read more >TypeScript errors and how to fix them
error TS2345: Argument of type ' number ' is not assignable to parameter of type ' TimerHandler '. Broken Code ❌. 1 2...
Read more >First TypeScript Program: Compile and Run - TutorialsTeacher
ts(5,32): error TS2345: Argument of type 'abc' is not assignable to parameter of type 'number'. So, TypeScript does not compile the code if...
Read more >TSConfig Reference - Docs on every TSConfig option
When set to true, TypeScript will raise an error when a class property was declared but not set in the constructor. ts. class...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Check out the TypeScript support section of the README. 🙂
One way around the limitations of the
isolatedModules
call for me was to create areactn.d.ts
file in astyles
folder and put the stuff from the README in there.That seems to load everything correctly, and typecheck appropriately.