mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
addressed PR feedback: added more tests
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
//// [tests/cases/compiler/typeReferenceDirectives13.ts] ////
|
||||
|
||||
//// [ref.d.ts]
|
||||
|
||||
export interface $ { x }
|
||||
|
||||
//// [index.d.ts]
|
||||
declare let $: { x: number }
|
||||
|
||||
//// [app.ts]
|
||||
/// <reference types="lib"/>
|
||||
import {$} from "./ref";
|
||||
export interface A {
|
||||
x: () => typeof $
|
||||
}
|
||||
|
||||
|
||||
//// [app.js]
|
||||
"use strict";
|
||||
|
||||
|
||||
//// [app.d.ts]
|
||||
/// <reference types="lib" />
|
||||
export interface A {
|
||||
x: () => typeof $;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
=== /app.ts ===
|
||||
/// <reference types="lib"/>
|
||||
import {$} from "./ref";
|
||||
>$ : Symbol($, Decl(app.ts, 1, 8))
|
||||
|
||||
export interface A {
|
||||
>A : Symbol(A, Decl(app.ts, 1, 24))
|
||||
|
||||
x: () => typeof $
|
||||
>x : Symbol(A.x, Decl(app.ts, 2, 20))
|
||||
>$ : Symbol($, Decl(app.ts, 1, 8))
|
||||
}
|
||||
|
||||
=== /ref.d.ts ===
|
||||
|
||||
export interface $ { x }
|
||||
>$ : Symbol($, Decl(ref.d.ts, 0, 0))
|
||||
>x : Symbol($.x, Decl(ref.d.ts, 1, 20))
|
||||
|
||||
=== /types/lib/index.d.ts ===
|
||||
declare let $: { x: number }
|
||||
>$ : Symbol($, Decl(index.d.ts, 0, 11))
|
||||
>x : Symbol(x, Decl(index.d.ts, 0, 16))
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
[
|
||||
"======== Resolving type reference directive 'lib', containing file '/app.ts', root directory '/'. ========",
|
||||
"Resolving with primary search path '/types/'",
|
||||
"File '/types/lib/package.json' does not exist.",
|
||||
"File '/types/lib/index.d.ts' exist - use it as a name resolution result.",
|
||||
"======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========",
|
||||
"======== Resolving module './ref' from '/app.ts'. ========",
|
||||
"Module resolution kind is not specified, using 'NodeJs'.",
|
||||
"Loading module as file / folder, candidate module location '/ref'.",
|
||||
"File '/ref.ts' does not exist.",
|
||||
"File '/ref.tsx' does not exist.",
|
||||
"File '/ref.d.ts' exist - use it as a name resolution result.",
|
||||
"======== Module name './ref' was successfully resolved to '/ref.d.ts'. ========"
|
||||
]
|
||||
@@ -0,0 +1,24 @@
|
||||
=== /app.ts ===
|
||||
/// <reference types="lib"/>
|
||||
import {$} from "./ref";
|
||||
>$ : any
|
||||
|
||||
export interface A {
|
||||
>A : A
|
||||
|
||||
x: () => typeof $
|
||||
>x : () => { x: number; }
|
||||
>$ : { x: number; }
|
||||
}
|
||||
|
||||
=== /ref.d.ts ===
|
||||
|
||||
export interface $ { x }
|
||||
>$ : $
|
||||
>x : any
|
||||
|
||||
=== /types/lib/index.d.ts ===
|
||||
declare let $: { x: number }
|
||||
>$ : { x: number; }
|
||||
>x : number
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// @noImplicitReferences: true
|
||||
// @declaration: true
|
||||
// @typesRoot: /
|
||||
// @traceResolution: true
|
||||
|
||||
// @filename: /ref.d.ts
|
||||
export interface $ { x }
|
||||
|
||||
// @filename: /types/lib/index.d.ts
|
||||
declare let $: { x: number }
|
||||
|
||||
// @filename: /app.ts
|
||||
/// <reference types="lib"/>
|
||||
import {$} from "./ref";
|
||||
export interface A {
|
||||
x: () => typeof $
|
||||
}
|
||||
Reference in New Issue
Block a user