Use # prefix on private class field with eslint-plugin-flowtype cause "Cannot read property 'type' of undefined"
See original GitHub issueBug Report
Clone of https://github.com/babel/babel-eslint/issues/688
As reported by @SebastienGllmt:
This exact issue still persists for me even if I crank all eslint & bable dependencies to their latest version. What’s more, this doesn’t always fail. For example in my case
This fails
#publicDeriverId: number; #bip44Wallet: IBip44Wallet; #derivationId: number; #pathToPublic: Array<number>; // only this specific private field causes an error.
This passes
#publicDeriverId: number; #bip44Wallet: IBip44Wallet; #derivationId: number; #pathToPublic: string; // note: this changed
Adding this totally unrelated type makes it work
type TotallyUnrelatedType = Array<number>; export class Foo { #publicDeriverId: number; #bip44Wallet: IBip44Wallet; #derivationId: number; #pathToPublic: Array<number>; }
_Originally posted by @SebastienGllmt in https://github.com/babel/babel-eslint/issues/688#issuecomment-531608020_
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Use # prefix on private class field with eslint-plugin-flowtype ...
Use # prefix on private class field with eslint-plugin-flowtype cause "Cannot read property 'type' of undefined" #688.
Read more >TypeError: Cannot read property 'prefix' of undefined
I'm using Fortawesome and found this thread but I am using and importing the icons correctly. The thing is I try and use...
Read more >Private class features - JavaScript - MDN Web Docs - Mozilla
Private class features. Class fields are public by default, but private class members can be created by using a hash # prefix. The...
Read more >Playground Example - Private Class Fields - TypeScript
3.8 adds private fields, which are a way of declaring a class field to be ... using an instance of the class to...
Read more >@babel/plugin-transform-for-of | Yarn - Package Manager
#11096 Wrap type-only class fields in flow comments (@nicolo-ribaudo) ... #10557 fix: disable caching when babel could not read/write cache. (@JLHwung) ...
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
Hey, sorry for the delay here. Do you mind sharing the versions of all
@babel/core
,eslint
,@babel/eslint-parser
, andeslint-plugin-flowtype
you’re using as well as the actual output from ESLint for the various examples? It’ll make it easier to understand what is going on.We can not enable the class features by default since it is a breaking change to ecosystem (but it is inevitable since Babel AST differs to ESTree). If you want to try on this feature