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

Avoid creating _base declarations #61087

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

CraigMacomber
Copy link

Fixes #59550

const varDecl = factory.createVariableDeclaration(newId, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(extendsClause.expression, input, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker), /*initializer*/ undefined);
const statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(SyntaxKind.DeclareKeyword)] : [], factory.createVariableDeclarationList([varDecl], NodeFlags.Const));
const baseType = resolver.createTypeOfExpression(extendsClause.expression, input, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker);
const extendsExpression = factory.createAsExpression(factory.createObjectLiteralExpression(), baseType!); // TODO: GH#18217
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having never worked on this code before, and the relevant types and methods mostly being undocumented, I don't know why this createTypeOfExpression might return undefined or if ignoring undefined values here is safe to do here.

I'm also not sure if putting the // TODO: GH#18217 makes sense or not: it seemed to be used to track questionable use of ! (like the one I removed below) so I left it here to help draw attention to the ! here.

@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Jan 31, 2025
@typescript-bot
Copy link
Collaborator

The TypeScript team hasn't accepted the linked issue #59550. If you can get it accepted, this PR will have a better chance of being reviewed.

1 similar comment
@typescript-bot
Copy link
Collaborator

The TypeScript team hasn't accepted the linked issue #59550. If you can get it accepted, this PR will have a better chance of being reviewed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Backlog Bug PRs that fix a backlog bug
Projects
Status: Not started
Development

Successfully merging this pull request may close these issues.

Inline *_base declaration in d.ts files
2 participants