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.

TypeError: Cannot read property 'flags' of undefined

See original GitHub issue

Do you want to request a feature or report a bug? A Bug

What is the current behaviour? Running yarn run build when installing @types modules breaks the build.

After installing the Typescript template, I’m trying to install styled-components, all goes fine until I install @types/styled-components.

If the current behaviour is a bug, please provide the steps to reproduce.

  1. preact create typescript my-project
  2. yarn add styled-components
  3. yarn add -D @types/styled-components
  4. yarn run build
  5. INTERNAL ERROR: Cannot read property 'flags' of undefined

What is the expected behaviour? Being able to install @types packages.

OS: macOS 10.15.3 Terminal: Hyper 3.1.0 Shell: zsh Node: v13.8.0 npm: 6.13.7 preact-cli: 2.2.1

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:16 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
mdziekoncommented, May 18, 2020

@RyanChristian4427 wrote:

As @mdziekon is removing Jest, it is fine for that to be removed from the template.

My PR does not remove Jest, but it replaces outdated render spy with Enzyme integration. Just wanted to clarify that to prevent any false assumptions.

1reaction
rschristiancommented, May 7, 2020

Does anyone know if the declaration.d.ts file is still needed? According to the TypeScript’s documentation, TS is able to pick the right JSX declaration from the factory function in use (https://www.typescriptlang.org/docs/handbook/jsx.html#factory-functions), so when using h it will automatically look for h.JSX which is defined in preact’s type definitions (similar story with createElement in compat mode).

As far as I can tell, removing this from a newly created project does not break anything, so unless there’s any other reason for having these re-declarations, could this simply be removed to get rid of the tssserver problem?

I added that, and it was just to allow the test lib to run. Nothing more. Definitely get rid of it. It was a temporary hack so all parts of the template “worked”.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ERROR in TypeError: Cannot read property 'flags' of undefined
First check ng --version . Go to next step if you get: Angular CLI: 9.1.4 Node: 12.16 ...
Read more >
Cannot read property 'flags' of undefined when running TSC ...
My particular circumstance is that only one component library package in my monorepo is producing this error. It happens when upgrading from 4.5 ......
Read more >
Cannot read property 'flags' of undefined : WEB-18383
typescript compiler throw error: Error:Error has occurred in the compile process TypeError: Cannot read property 'flags' of undefined : WEB-18383.
Read more >
Angular – ERROR in TypeError: Cannot read property 'flags' of ...
Angular – ERROR in TypeError: Cannot read property 'flags' of undefined. angulartypescript. I have a problem when I try to run ng serve...
Read more >
Uncaught TypeError: Cannot read property 'flag' of undefined
Hello! I'll do my best to help you solve this issue. I tried to log in and check the issue, but it seems...
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