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

Add fix for webpack history merge bug #29339

Merged
merged 3 commits into from
Mar 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 14 additions & 0 deletions tests/baselines/reference/noCrashUMDMergedWithGlobalValue.js
Original file line number Diff line number Diff line change
@@ -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]
18 changes: 18 additions & 0 deletions tests/baselines/reference/noCrashUMDMergedWithGlobalValue.symbols
Original file line number Diff line number Diff line change
@@ -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))

15 changes: 15 additions & 0 deletions tests/baselines/reference/noCrashUMDMergedWithGlobalValue.types
Original file line number Diff line number Diff line change
@@ -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")

9 changes: 9 additions & 0 deletions tests/cases/compiler/noCrashUMDMergedWithGlobalValue.ts
Original file line number Diff line number Diff line change
@@ -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;