question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Building react-pixi-fiber@0.4.5 with TypeScript throws error

See original GitHub issue

Description

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:closed
  • Created 5 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
michalochmancommented, May 22, 2018

@Fabiantjoeaon try v0.4.6 with your fixes

0reactions
Fabiantjoeaoncommented, May 19, 2018

All 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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found