Building react-pixi-fiber@0.4.5 with TypeScript throws error
See original GitHub issueDescription
When building react-pixi-fiber with typescript there is an error in the type declarations:
`Failed to compile.
/Applications/MAMP/htdocs/relive/skyhawk-cards/node_modules/react-pixi-fiber/index.d.ts (154,19): Cannot redeclare block-scoped variable ‘CustomPIXIComponent’.`
Steps to reproduce
I’m building with TS with the following config:
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"sourceMap": true,
"removeComments": false,
"outDir": "build",
"noImplicitAny": true,
"alwaysStrict": true,
"strictNullChecks": true,
"noUnusedLocals": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"allowSyntheticDefaultImports": true,
"moduleResolution": "node",
"baseUrl": ".",
"jsx": "react",
"declaration": true,
"allowJs": false
},
"compileOnSave": true
}
Additional info
react-pixi-fiber version: “0.4.5” React version: “^16.3.2” ReactDOM version: “^16.3.2” PixiJS version: “^4.7.3”
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
How to declare a function that throws an error in Typescript
It's possible to specify error type only if a function returns an error, not throws it (this rarely happens and is prone to...
Read more >Documentation - TypeScript 4.4
When we pass an object literal to something with an expected type, TypeScript will look for excess properties that weren't declared in the...
Read more >Get a catch block error message with TypeScript - Kent C. Dodds
TypeScript forces you to acknowledge you can't know what was thrown making getting the error message a pain. Here's how you can manage...
Read more >Improving TypeScript error handling with exhaustive type ...
Discover an improved method for handling errors in TypeScript that solves problems that arise from returning null and throwing try...catch.
Read more >Tsconfig show typescript file not found error after moving it to ...
Issue Type: Bug When I move a typescript file from a directory into another directory or delete the file from vscode, it shows...
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
@Fabiantjoeaon try
v0.4.6
with your fixesAll right, I did some research and made a PR.
When adding the CustomPIXIComponent typing under its own namespace, it fixes the issue, and my code runs without having issues regarding importing CustomPIXIComponent. I based it on this SO question: https://stackoverflow.com/questions/40900791/cannot-redeclare-block-scoped-variable-in-unrelated-files/41975448
This is my first PR, so please tell me if I’m doing something wrong.