Skip to content

Replace only local type parameters with any when creating prototype property type of a class#57323

Closed
Andarist wants to merge 2 commits intomicrosoft:mainfrom
Andarist:prototype-property-anyify-only-local-type-params
Closed

Replace only local type parameters with any when creating prototype property type of a class#57323
Andarist wants to merge 2 commits intomicrosoft:mainfrom
Andarist:prototype-property-anyify-only-local-type-params

Conversation

@Andarist
Copy link
Copy Markdown
Contributor

@Andarist Andarist commented Feb 7, 2024

fixes #57317
this is different from #49863 - that PR likely still has a bug that I'm fixing here because it would replace the outer type parameter with its constraint

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Feb 7, 2024
// It is an error to explicitly declare a static property member with the name 'prototype'.
const classType = getDeclaredTypeOfSymbol(getParentOfSymbol(prototype)!) as InterfaceType;
return classType.typeParameters ? createTypeReference(classType as GenericType, map(classType.typeParameters, _ => anyType)) : classType;
return classType.localTypeParameters ? createTypeReference(classType as GenericType, concatenate(classType.outerTypeParameters, map(classType.localTypeParameters, _ => anyType))) : classType;
Copy link
Copy Markdown
Contributor Author

@Andarist Andarist Feb 7, 2024

Choose a reason for hiding this comment

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

I wonder if this doesn't create any type parameter leak or something like this but so far I couldn't recognize any unintended side-effect like this here.

@typescript-bot typescript-bot added For Backlog Bug PRs that fix a backlog bug and removed For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Feb 16, 2024
@sandersn sandersn requested a review from weswigham February 16, 2024 14:08
…yify-only-local-type-params

# Conflicts:
#	tests/baselines/reference/accessorsOverrideProperty9.types
#	tests/baselines/reference/amdDeclarationEmitNoExtraDeclare.types
#	tests/baselines/reference/anonClassDeclarationEmitIsAnon.types
#	tests/baselines/reference/baseConstraintOfDecorator.types
#	tests/baselines/reference/declarationEmitLocalClassDeclarationMixin.types
#	tests/baselines/reference/declarationEmitPrivateNameCausesError.types
#	tests/baselines/reference/doubleMixinConditionalTypeBaseClassWorks.types
#	tests/baselines/reference/emitClassExpressionInDeclarationFile.types
#	tests/baselines/reference/emitClassExpressionInDeclarationFile2.types
#	tests/baselines/reference/exportClassExtendingIntersection.types
#	tests/baselines/reference/mixinAbstractClasses.2.types
#	tests/baselines/reference/mixinAbstractClasses.types
#	tests/baselines/reference/mixinAbstractClassesReturnTypeInference.types
#	tests/baselines/reference/mixinClassesAnnotated.types
#	tests/baselines/reference/mixinClassesAnonymous.types
#	tests/baselines/reference/mixinIntersectionIsValidbaseType.types
#	tests/baselines/reference/mixinOverMappedTypeNoCrash.types
#	tests/baselines/reference/mixinPrivateAndProtected.types
#	tests/baselines/reference/mixingApparentTypeOverrides.types
#	tests/baselines/reference/noCrashOnMixin.types
#	tests/baselines/reference/overrideBaseIntersectionMethod.types
#	tests/baselines/reference/typeAliasFunctionTypeSharedSymbol.types
@typescript-bot
Copy link
Copy Markdown
Collaborator

With 6.0 out as the final release vehicle for this codebase, we're closing all PRs that don't fit the merge criteria for post-6.0 patches. If you think this was a mistake and this PR fits the post-6.0 patch criteria, please post to the 6.0 iteration issue with details (specifically, which PR and which patch criteria it satisfies).

Next steps for PRs:

  • For crash bugfixes or language service improvements, PRs are currently accepted at the typescript-go repo
  • Changes to type system behavior should wait until after 7.0, at which point mainline TypeScript development will resume in this repository with the Go codebase
  • Library file updates (lib.d.ts etc) continue to live in this repo or the DOM Generator repo as appropriate

@github-project-automation github-project-automation bot moved this from Waiting on reviewers to Done in PR Backlog Mar 24, 2026
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: Done

Development

Successfully merging this pull request may close these issues.

Make instanceof narrow better using an anonymous class returned from a function

5 participants