Skip to content

isConstructorType checks base constraint for undefined#14250

Merged
sandersn merged 1 commit into
masterfrom
fix-crash-in-isConstructorType
Feb 22, 2017
Merged

isConstructorType checks base constraint for undefined#14250
sandersn merged 1 commit into
masterfrom
fix-crash-in-isConstructorType

Conversation

@sandersn
Copy link
Copy Markdown
Member

@sandersn sandersn commented Feb 22, 2017

Previously, isConstructorType assumed there was always a base constraint for all type variables. When the base constraint it missing, it caused a crash because the base constraint was undefined.

isConstructorType uses getBaseConstraintOfType to get the constraint on the type variable. All other callers to getBaseConstraintOfType check for undefined before using the constraint, so the fix is to check for undefined here too.

Fixes #14238

Previously, it assumed there was always a base constraint, which is true
for correct code. For incorrect code, the base constraint may be
missing, which caused a crash because the base constraint was undefined.
@sandersn sandersn merged commit 746c45c into master Feb 22, 2017
@sandersn sandersn deleted the fix-crash-in-isConstructorType branch February 22, 2017 22:31
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tsc crash: TypeError: Cannot read property 'flags' of undefined

3 participants