Add fix for webpack history merge bug (#29339)

* Add fix for webpack history merge bug

* Add test case
This commit is contained in:
Wesley Wigham 2019-03-07 13:34:28 -08:00 committed by GitHub
parent 3f7357d37f
commit 4c9ad08610
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 57 additions and 1 deletions

View file

@ -8790,7 +8790,7 @@ namespace ts {
function getTypeReferenceTypeWorker(node: NodeWithTypeArguments, symbol: Symbol, typeArguments: Type[] | undefined): Type | undefined {
if (symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface)) {
if (symbol.valueDeclaration && isBinaryExpression(symbol.valueDeclaration.parent)) {
if (symbol.valueDeclaration && symbol.valueDeclaration.parent && isBinaryExpression(symbol.valueDeclaration.parent)) {
const jsdocType = getJSDocTypeReference(node, symbol, typeArguments);
if (jsdocType) {
return jsdocType;

View file

@ -0,0 +1,14 @@
//// [tests/cases/compiler/noCrashUMDMergedWithGlobalValue.ts] ////
//// [other.d.ts]
export as namespace SomeInterface;
export type Action = "PUSH" | "POP" | "REPLACE";
//// [main.ts]
interface SomeInterface {
readonly length: number;
}
declare const value: SomeInterface;
//// [main.js]

View file

@ -0,0 +1,18 @@
=== /other.d.ts ===
export as namespace SomeInterface;
>SomeInterface : Symbol(SomeInterface, Decl(other.d.ts, 0, 0))
export type Action = "PUSH" | "POP" | "REPLACE";
>Action : Symbol(Action, Decl(other.d.ts, 0, 34))
=== /main.ts ===
interface SomeInterface {
>SomeInterface : Symbol("/other", Decl(other.d.ts, 0, 0), Decl(main.ts, 0, 0))
readonly length: number;
>length : Symbol(length, Decl(main.ts, 0, 25))
}
declare const value: SomeInterface;
>value : Symbol(value, Decl(main.ts, 3, 13))
>SomeInterface : Symbol("/other", Decl(other.d.ts, 0, 0), Decl(main.ts, 0, 0))

View file

@ -0,0 +1,15 @@
=== /other.d.ts ===
export as namespace SomeInterface;
>SomeInterface : typeof import("/other")
export type Action = "PUSH" | "POP" | "REPLACE";
>Action : Action
=== /main.ts ===
interface SomeInterface {
readonly length: number;
>length : number
}
declare const value: SomeInterface;
>value : import("/other")

View file

@ -0,0 +1,9 @@
//@filename: /other.d.ts
export as namespace SomeInterface;
export type Action = "PUSH" | "POP" | "REPLACE";
//@filename: /main.ts
interface SomeInterface {
readonly length: number;
}
declare const value: SomeInterface;