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

[hoist-class-statics] TypeError: Cannot destructure property 'declarations' of 'statement.declarationList' as it is undefined #155

Open
amitbeck opened this issue Jan 18, 2022 · 1 comment
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@amitbeck
Copy link

amitbeck commented Jan 18, 2022

Using version 0.1.27

Error stack

Error: [hoist-class-statics][index.ts] Error:
 TypeError: Cannot destructure property 'declarations' of 'statement.declarationList' as it is undefined.
    at node_modules/ts-migrate-plugins/build/src/plugins/utils/identifiers.js:61:17
    at Array.forEach (<anonymous>)
    at Object.findKnownVariables (node_modules/ts-migrate-plugins/build/src/plugins/utils/identifiers.js:60:24)
    at hoistStaticClassProperties (node_modules/ts-migrate-plugins/build/src/plugins/hoist-class-statics.js:66:121)
    at Object.run (node_modules/ts-migrate-plugins/build/src/plugins/hoist-class-statics.js:14:16)
    at Object.migrate (node_modules/ts-migrate-server/build/src/migrate/index.js:63:46)
    at async Object.handler (node_modules/ts-migrate/build/cli.js:133:22)

Example semi-migrated file (index.ts)

// @ts-expect-error ts-migrate(2580) FIXME: Cannot find name 'module'. Do you need to install ... Remove this comment to see the full error message
module.exports = {
    // @ts-expect-error ts-migrate(2580) FIXME: Cannot find name 'require'. Do you need to install... Remove this comment to see the full error message
    foo: require('./foo'),
    // @ts-expect-error ts-migrate(2580) FIXME: Cannot find name 'require'. Do you need to install... Remove this comment to see the full error message
    bar: require('./bar'),
    // @ts-expect-error ts-migrate(2580) FIXME: Cannot find name 'require'. Do you need to install... Remove this comment to see the full error message
    baz: require('./baz'),
};
@amitbeck amitbeck changed the title hoist-class-statics fails with TypeError: Cannot destructure property 'declarations' of 'statement.declarationList' as it is undefined. [hoist-class-statics] TypeError: Cannot destructure property 'declarations' of 'statement.declarationList' as it is undefined Jan 18, 2022
@Rudeg Rudeg added bug Something isn't working help wanted Extra attention is needed labels Mar 28, 2022
@chrismv48
Copy link

I'm getting this error too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants