Skip to content

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

Description

@marcellomontemagno

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 typescript@3.8.3

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions