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

TypeError: Cannot read properties of undefined (reading 'flags') at needsNameFromDeclaration at getNameForExportedSymbol #59159

Closed
Andarist opened this issue Jul 6, 2024 · 1 comment Β· Fixed by #59160
Assignees
Labels
Bug A bug in TypeScript Crash For flagging bugs which are compiler or service crashes or unclean exits, rather than bad output Fix Available A PR has been opened for this issue

Comments

@Andarist
Copy link
Contributor

Andarist commented Jul 6, 2024

πŸ”Ž Search Terms

import type node class member completion parameter method

πŸ•— Version & Regression Information

  • This is a crash

⏯ Playground Link

N/A

πŸ’» Code

/// <reference path="fourslash.ts" />

// @module: nodenext

// @Filename: /generation.d.ts
//// export type GenerationConfigType = { max_length?: number };

// @FileName: /index.d.ts
//// export declare class PreTrainedModel {
////   _get_generation_config(
////     param: import("./generation.js").GenerationConfigType,
////   ): import("./generation.js").GenerationConfigType;
//// }
////
//// export declare class BlenderbotSmallPreTrainedModel extends PreTrainedModel {
////   /*1*/
//// }

verify.completions({
  marker: "1",
  includes: [
    {
      name: "_get_generation_config",
      insertText: `_get_generation_config(param: import("./generation.js").GenerationConfigType): import("./generation.js").GenerationConfigType;`,
      filterText: "_get_generation_config",
    },
  ],
  preferences: {
    includeCompletionsWithClassMemberSnippets: true,
    includeCompletionsWithInsertText: true,
  },
  isNewIdentifierLocation: true,
});

πŸ™ Actual behavior

crash

πŸ™‚ Expected behavior

no crash

Additional information about the issue

repro based on #59085 (comment):

Req #6451 - completionInfo
    at needsNameFromDeclaration (/typescript-5.6.0-dev.20240630/lib/typescript.js:138216:19)
    at getNameForExportedSymbol (/typescript-5.6.0-dev.20240630/lib/typescript.js:138210:7)
    at visit (/typescript-5.6.0-dev.20240630/lib/typescript.js:161488:20)
    at visitNode (/typescript-5.6.0-dev.20240630/lib/typescript.js:92400:19)
    at tryGetAutoImportableReferenceFromTypeNode (/typescript-5.6.0-dev.20240630/lib/typescript.js:161481:20)
    at /typescript-5.6.0-dev.20240630/lib/typescript.js:161118:37
    at sameMap (/typescript-5.6.0-dev.20240630/lib/typescript.js:2470:22)
    at createSignatureDeclarationFromSignature (/typescript-5.6.0-dev.20240630/lib/typescript.js:161115:27)
    at outputMethod (/typescript-5.6.0-dev.20240630/lib/typescript.js:161017:20)
    at Object.addNewNodeForMemberSymbol (/typescript-5.6.0-dev.20240630/lib/typescript.js:160999:9)
    at getEntryForMemberCompletion (/typescript-5.6.0-dev.20240630/lib/typescript.js:163718:22)
    at createCompletionEntry (/typescript-5.6.0-dev.20240630/lib/typescript.js:163566:35)
    at getCompletionEntriesFromSymbols (/typescript-5.6.0-dev.20240630/lib/typescript.js:164192:19)
    at completionInfoFromData (/typescript-5.6.0-dev.20240630/lib/typescript.js:163218:23)
    at Object.getCompletionsAtPosition (/typescript-5.6.0-dev.20240630/lib/typescript.js:162764:24)
    at Object.getCompletionsAtPosition2 [as getCompletionsAtPosition] (/typescript-5.6.0-dev.20240630/lib/typescript.js:149346:35)
    at IOSession.getCompletions (/typescript-5.6.0-dev.20240630/lib/typescript.js:190799:54)
    at completionInfo (/typescript-5.6.0-dev.20240630/lib/typescript.js:189137:43)
    at /typescript-5.6.0-dev.20240630/lib/typescript.js:191603:15
    at IOSession.executeWithRequestId (/typescript-5.6.0-dev.20240630/lib/typescript.js:191592:14)
    at IOSession.executeCommand (/typescript-5.6.0-dev.20240630/lib/typescript.js:191601:29)
    at IOSession.onMessage (/typescript-5.6.0-dev.20240630/lib/typescript.js:191649:68)
    at Interface.<anonymous> (/typescript-5.6.0-dev.20240630/lib/tsserver.js:501:14)
@andrewbranch andrewbranch self-assigned this Jul 9, 2024
@andrewbranch andrewbranch added Bug A bug in TypeScript Crash For flagging bugs which are compiler or service crashes or unclean exits, rather than bad output labels Jul 9, 2024
@andrewbranch
Copy link
Member

This is a 5.5 regression

@andrewbranch andrewbranch added this to the TypeScript 5.5.4 milestone Jul 10, 2024
@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Crash For flagging bugs which are compiler or service crashes or unclean exits, rather than bad output Fix Available A PR has been opened for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants