Skip to content
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 internal/checker/nodebuilderimpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func (b *NodeBuilderImpl) appendReferenceToType(root *ast.TypeNode, ref *ast.Typ
imprt := root.AsImportTypeNode()
// then move qualifiers
ids := getAccessStack(ref)
var qualifier *ast.Node
qualifier := root.AsImportTypeNode().Qualifier
for _, id := range ids {
if qualifier != nil {
qualifier = b.f.NewQualifiedName(qualifier, id)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
//// [tests/cases/compiler/declarationEmitQualifiedName.ts] ////

//// [e.ts]
export enum E {
A = 'a',
B = 'b',
}

//// [a.ts]
import { E } from './e.js'
export const A = {
item: {
a: E.A,
},
} as const

//// [b.ts]
import { A } from './a.js'
export const B = { ...A } as const


//// [e.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.E = void 0;
var E;
(function (E) {
E["A"] = "a";
E["B"] = "b";
})(E || (exports.E = E = {}));
//// [a.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.A = void 0;
const e_js_1 = require("./e.js");
exports.A = {
item: {
a: e_js_1.E.A,
},
};
//// [b.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.B = void 0;
const a_js_1 = require("./a.js");
exports.B = Object.assign({}, a_js_1.A);


//// [e.d.ts]
export declare enum E {
A = "a",
B = "b"
}
//// [a.d.ts]
import { E } from './e.js';
export declare const A: {
readonly item: {
readonly a: E.A;
};
};
//// [b.d.ts]
export declare const B: {
readonly item: {
readonly a: import("./e.js").E.A;
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
//// [tests/cases/compiler/declarationEmitQualifiedName.ts] ////

=== e.ts ===
export enum E {
>E : Symbol(E, Decl(e.ts, 0, 0))

A = 'a',
>A : Symbol(E.A, Decl(e.ts, 0, 15))

B = 'b',
>B : Symbol(E.B, Decl(e.ts, 1, 12))
}

=== a.ts ===
import { E } from './e.js'
>E : Symbol(E, Decl(a.ts, 0, 8))

export const A = {
>A : Symbol(A, Decl(a.ts, 1, 12))

item: {
>item : Symbol(item, Decl(a.ts, 1, 18))

a: E.A,
>a : Symbol(a, Decl(a.ts, 2, 11))
>E.A : Symbol(E.A, Decl(e.ts, 0, 15))
>E : Symbol(E, Decl(a.ts, 0, 8))
>A : Symbol(E.A, Decl(e.ts, 0, 15))

},
} as const
>const : Symbol(const)

=== b.ts ===
import { A } from './a.js'
>A : Symbol(A, Decl(b.ts, 0, 8))

export const B = { ...A } as const
>B : Symbol(B, Decl(b.ts, 1, 12))
>A : Symbol(A, Decl(b.ts, 0, 8))
>const : Symbol(const)

Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//// [tests/cases/compiler/declarationEmitQualifiedName.ts] ////

=== e.ts ===
export enum E {
>E : E

A = 'a',
>A : E.A
>'a' : "a"

B = 'b',
>B : E.B
>'b' : "b"
}

=== a.ts ===
import { E } from './e.js'
>E : typeof E

export const A = {
>A : { readonly item: { readonly a: E.A; }; }
>{ item: { a: E.A, },} as const : { readonly item: { readonly a: E.A; }; }
>{ item: { a: E.A, },} : { readonly item: { readonly a: E.A; }; }

item: {
>item : { readonly a: E.A; }
>{ a: E.A, } : { readonly a: E.A; }

a: E.A,
>a : E.A
>E.A : E.A
>E : typeof E
>A : E.A

},
} as const

=== b.ts ===
import { A } from './a.js'
>A : { readonly item: { readonly a: import("e").E.A; }; }

export const B = { ...A } as const
>B : { readonly item: { readonly a: import("e").E.A; }; }
>{ ...A } as const : { readonly item: { readonly a: import("e").E.A; }; }
>{ ...A } : { readonly item: { readonly a: import("e").E.A; }; }
>A : { readonly item: { readonly a: import("e").E.A; }; }

19 changes: 19 additions & 0 deletions testdata/tests/cases/compiler/declarationEmitQualifiedName.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// @declaration: true

// @filename: e.ts
export enum E {
A = 'a',
B = 'b',
}

// @filename: a.ts
import { E } from './e.js'
export const A = {
item: {
a: E.A,
},
} as const

// @filename: b.ts
import { A } from './a.js'
export const B = { ...A } as const