File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -7837,14 +7837,17 @@ namespace ts {
7837
7837
}
7838
7838
7839
7839
function isDiscriminantProperty(type: Type, name: string) {
7840
- if (type && type.flags & TypeFlags.Union) {
7841
- const prop = getPropertyOfType(type, name);
7842
- if (prop && prop.flags & SymbolFlags.SyntheticProperty) {
7843
- if ((<TransientSymbol>prop).isDiscriminantProperty === undefined) {
7844
- (<TransientSymbol>prop).isDiscriminantProperty = !(<TransientSymbol>prop).hasCommonType &&
7845
- isUnitUnionType(getTypeOfSymbol(prop));
7846
- }
7847
- return (<TransientSymbol>prop).isDiscriminantProperty;
7840
+ if (type) {
7841
+ const nonNullType = getNonNullableType(type);
7842
+ if (nonNullType.flags & TypeFlags.Union) {
7843
+ const prop = getPropertyOfType(nonNullType, name);
7844
+ if (prop && prop.flags & SymbolFlags.SyntheticProperty) {
7845
+ if ((<TransientSymbol>prop).isDiscriminantProperty === undefined) {
7846
+ (<TransientSymbol>prop).isDiscriminantProperty = !(<TransientSymbol>prop).hasCommonType &&
7847
+ isUnitUnionType(getTypeOfSymbol(prop));
7848
+ }
7849
+ return (<TransientSymbol>prop).isDiscriminantProperty;
7850
+ }
7848
7851
}
7849
7852
}
7850
7853
return false;
You can’t perform that action at this time.
0 commit comments