1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
=== tests/cases/conformance/ambient/user.ts ===
///<reference path="declarations.d.ts" />
import {foo, baz} from "foobarbaz";
>foo : (s: string) => void
>baz : string
foo(baz);
>foo(baz) : void
>foo : (s: string) => void
>baz : string
import {foos} from "foosball";
>foos : string
foo(foos);
>foo(foos) : void
>foo : (s: string) => void
>foos : string
// Works with relative file name
import fileText from "./file!text";
>fileText : string
foo(fileText);
>foo(fileText) : void
>foo : (s: string) => void
>fileText : string
=== tests/cases/conformance/ambient/declarations.d.ts ===
declare module "foo*baz" {
>"foo*baz" : typeof import("foo*baz")
export function foo(s: string): void;
>foo : (s: string) => void
>s : string
}
// Augmentations still work
declare module "foo*baz" {
>"foo*baz" : typeof import("foo*baz")
export const baz: string;
>baz : string
}
// Longest prefix wins
declare module "foos*" {
>"foos*" : typeof import("foos*")
export const foos: string;
>foos : string
}
declare module "*!text" {
>"*!text" : typeof import("*!text")
const x: string;
>x : string
export default x;
>x : string
}
|