-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
[Release-2.0.5] Port fix from master to release-2.0.5: Serialize type alias when type-alias is not accessible and emit generic #11392
Changes from all commits
06492fa
1852746
d806cce
a401ba5
4fb0f06
f6b3afa
948cd1e
40b5627
e38252d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,21 +62,21 @@ declare function isHTMLCollection(sourceObj: any): sourceObj is HTMLCollection; | |
>HTMLCollection : HTMLCollection | ||
|
||
type EventTargetLike = {a: string} | HTMLCollection | NodeList; | ||
>EventTargetLike : EventTargetLike | ||
>EventTargetLike : NodeList | HTMLCollection | { a: string; } | ||
>a : string | ||
>HTMLCollection : HTMLCollection | ||
>NodeList : NodeList | ||
|
||
var sourceObj: EventTargetLike = <any>undefined; | ||
>sourceObj : EventTargetLike | ||
>EventTargetLike : EventTargetLike | ||
>sourceObj : NodeList | HTMLCollection | { a: string; } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this be sourceObj: EventTargetLike? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems like it should. However what happen is that the file is an external module. So when we are in BuildTypeDisplay, checking whether |
||
>EventTargetLike : NodeList | HTMLCollection | { a: string; } | ||
><any>undefined : any | ||
>undefined : undefined | ||
|
||
if (isNodeList(sourceObj)) { | ||
>isNodeList(sourceObj) : boolean | ||
>isNodeList : (sourceObj: any) => sourceObj is NodeList | ||
>sourceObj : EventTargetLike | ||
>sourceObj : NodeList | HTMLCollection | { a: string; } | ||
|
||
sourceObj.length; | ||
>sourceObj.length : number | ||
|
@@ -87,7 +87,7 @@ if (isNodeList(sourceObj)) { | |
if (isHTMLCollection(sourceObj)) { | ||
>isHTMLCollection(sourceObj) : boolean | ||
>isHTMLCollection : (sourceObj: any) => sourceObj is HTMLCollection | ||
>sourceObj : EventTargetLike | ||
>sourceObj : NodeList | HTMLCollection | { a: string; } | ||
|
||
sourceObj.length; | ||
>sourceObj.length : number | ||
|
@@ -99,7 +99,7 @@ if (isNodeList(sourceObj) || isHTMLCollection(sourceObj)) { | |
>isNodeList(sourceObj) || isHTMLCollection(sourceObj) : boolean | ||
>isNodeList(sourceObj) : boolean | ||
>isNodeList : (sourceObj: any) => sourceObj is NodeList | ||
>sourceObj : EventTargetLike | ||
>sourceObj : NodeList | HTMLCollection | { a: string; } | ||
>isHTMLCollection(sourceObj) : boolean | ||
>isHTMLCollection : (sourceObj: any) => sourceObj is HTMLCollection | ||
>sourceObj : HTMLCollection | { a: string; } | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//// [declarationEmitArrayTypesFromGenericArrayUsage.ts] | ||
interface A extends Array<string> { } | ||
|
||
|
||
//// [declarationEmitArrayTypesFromGenericArrayUsage.js] | ||
|
||
|
||
//// [declarationEmitArrayTypesFromGenericArrayUsage.d.ts] | ||
interface A extends Array<string> { | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
=== tests/cases/compiler/declarationEmitArrayTypesFromGenericArrayUsage.ts === | ||
interface A extends Array<string> { } | ||
>A : Symbol(A, Decl(declarationEmitArrayTypesFromGenericArrayUsage.ts, 0, 0)) | ||
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
=== tests/cases/compiler/declarationEmitArrayTypesFromGenericArrayUsage.ts === | ||
interface A extends Array<string> { } | ||
>A : A | ||
>Array : T[] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
=== tests/cases/compiler/declarationEmitBindingPatterns.ts === | ||
|
||
const k = ({x: z = 'y'}) => { } | ||
>k : Symbol(k, Decl(declarationEmitBindingPatterns.ts, 1, 5)) | ||
>x : Symbol(x) | ||
>z : Symbol(z, Decl(declarationEmitBindingPatterns.ts, 1, 12)) | ||
|
||
var a; | ||
>a : Symbol(a, Decl(declarationEmitBindingPatterns.ts, 3, 3)) | ||
|
||
function f({} = a, [] = a, { p: {} = a} = a) { | ||
>f : Symbol(f, Decl(declarationEmitBindingPatterns.ts, 3, 6)) | ||
>a : Symbol(a, Decl(declarationEmitBindingPatterns.ts, 3, 3)) | ||
>a : Symbol(a, Decl(declarationEmitBindingPatterns.ts, 3, 3)) | ||
>a : Symbol(a, Decl(declarationEmitBindingPatterns.ts, 3, 3)) | ||
>a : Symbol(a, Decl(declarationEmitBindingPatterns.ts, 3, 3)) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
=== tests/cases/compiler/declarationEmitClassMemberNameConflict.ts === | ||
|
||
export class C1 { | ||
>C1 : Symbol(C1, Decl(declarationEmitClassMemberNameConflict.ts, 0, 0)) | ||
|
||
C1() { } // has to be the same as the class name | ||
>C1 : Symbol(C1.C1, Decl(declarationEmitClassMemberNameConflict.ts, 1, 17)) | ||
|
||
bar() { | ||
>bar : Symbol(C1.bar, Decl(declarationEmitClassMemberNameConflict.ts, 2, 12)) | ||
|
||
return function (t: typeof C1) { | ||
>t : Symbol(t, Decl(declarationEmitClassMemberNameConflict.ts, 5, 25)) | ||
>C1 : Symbol(C1, Decl(declarationEmitClassMemberNameConflict.ts, 0, 0)) | ||
|
||
}; | ||
} | ||
} | ||
|
||
export class C2 { | ||
>C2 : Symbol(C2, Decl(declarationEmitClassMemberNameConflict.ts, 8, 1)) | ||
|
||
C2: any // has to be the same as the class name | ||
>C2 : Symbol(C2.C2, Decl(declarationEmitClassMemberNameConflict.ts, 10, 17)) | ||
|
||
bar() { | ||
>bar : Symbol(C2.bar, Decl(declarationEmitClassMemberNameConflict.ts, 11, 11)) | ||
|
||
return function (t: typeof C2) { | ||
>t : Symbol(t, Decl(declarationEmitClassMemberNameConflict.ts, 14, 25)) | ||
>C2 : Symbol(C2, Decl(declarationEmitClassMemberNameConflict.ts, 8, 1)) | ||
|
||
}; | ||
} | ||
} | ||
|
||
export class C3 { | ||
>C3 : Symbol(C3, Decl(declarationEmitClassMemberNameConflict.ts, 17, 1)) | ||
|
||
get C3() { return 0; } // has to be the same as the class name | ||
>C3 : Symbol(C3.C3, Decl(declarationEmitClassMemberNameConflict.ts, 19, 17)) | ||
|
||
bar() { | ||
>bar : Symbol(C3.bar, Decl(declarationEmitClassMemberNameConflict.ts, 20, 26)) | ||
|
||
return function (t: typeof C3) { | ||
>t : Symbol(t, Decl(declarationEmitClassMemberNameConflict.ts, 23, 25)) | ||
>C3 : Symbol(C3, Decl(declarationEmitClassMemberNameConflict.ts, 17, 1)) | ||
|
||
}; | ||
} | ||
} | ||
|
||
export class C4 { | ||
>C4 : Symbol(C4, Decl(declarationEmitClassMemberNameConflict.ts, 26, 1)) | ||
|
||
set C4(v) { } // has to be the same as the class name | ||
>C4 : Symbol(C4.C4, Decl(declarationEmitClassMemberNameConflict.ts, 28, 17)) | ||
>v : Symbol(v, Decl(declarationEmitClassMemberNameConflict.ts, 29, 11)) | ||
|
||
bar() { | ||
>bar : Symbol(C4.bar, Decl(declarationEmitClassMemberNameConflict.ts, 29, 17)) | ||
|
||
return function (t: typeof C4) { | ||
>t : Symbol(t, Decl(declarationEmitClassMemberNameConflict.ts, 32, 25)) | ||
>C4 : Symbol(C4, Decl(declarationEmitClassMemberNameConflict.ts, 26, 1)) | ||
|
||
}; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This condition looks too complicated. Can you make it readable by adding comments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is a comment already here