Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'flags' of undefined when imported in a typescript file #71

Open
marcellomontemagno opened this issue May 5, 2020 · 0 comments

Comments

@marcellomontemagno
Copy link

marcellomontemagno commented May 5, 2020

Hi,

I will try to open the same issue on the typescript repo asap, I'm trying here first because my typescript configuration has been used for quite some time and this is the only dependency giving me this problem.

Adding the following line in a .tsx file

import ResizeObserver from 'resize-observer-polyfill';

causes the following error in [email protected]

ERROR in INTERNAL ERROR: Cannot read property 'flags' of undefined
stack trace:
TypeError: Cannot read property 'flags' of undefined
    at getFlowTypeOfReference (/Users/marcellomontemango/Cello/monorepo/fe/ui-kit/node_modules/typescript/lib/typescript.js:51978:80)
    at tryGetThisTypeAt (/Users/marcellomontemango/Cello/monorepo/fe/ui-kit/node_modules/typescript/lib/typescript.js:53380:32)
    at checkThisExpression (/Users/marcellomontemango/Cello/monorepo/fe/ui-kit/node_modules/typescript/lib/typescript.js:53348:24)
    at checkExpressionWorker (/Users/marcellomontemango/Cello/monorepo/fe/ui-kit/node_modules/typescript/lib/typescript.js:60075:28)
    at checkExpression (/Users/marcellomontemango/Cello/monorepo/fe/ui-kit/node_modules/typescript/lib/typescript.js:60023:38)
    at checkExpressionWithContextualType (/Users/marcellomontemango/Cello/monorepo/fe/ui-kit/node_modules/typescript/lib/typescript.js:59672:28)
    at getSignatureApplicabilityError (/Users/marcellomontemango/Cello/monorepo/fe/ui-kit/node_modules/typescript/lib/typescript.js:56491:35)
    at chooseOverload (/Users/marcellomontemango/Cello/monorepo/fe/ui-kit/node_modules/typescript/lib/typescript.js:56939:25)
    at resolveCall (/Users/marcellomontemango/Cello/monorepo/fe/ui-kit/node_modules/typescript/lib/typescript.js:56838:26)
    at resolveCallExpression (/Users/marcellomontemango/Cello/monorepo/fe/ui-kit/node_modules/typescript/lib/typescript.js:57215:20)

I wish there was more info in the stack trace, I know the cause of the issue is linked with the import because is the only line I added since the problem appeared, plus, if I remove it everything behaves normally.

Here my tsconfig

{
  "compilerOptions": {
    "jsx": "react",
    "allowJs": true,
    "esModuleInterop": true,
    "strict": true,
    "outDir": "./tsDist/"
  }
}

Any idea about what could be possibly causing this?

The version of resize-observer-polyfill I'm trying to use is "1.5.1".

Thank you for your time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant