File: ambientDeclarationsPatterns.types

package info (click to toggle)
node-typescript 2.1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 203,952 kB
  • ctags: 52,987
  • sloc: sh: 11; makefile: 5
file content (54 lines) | stat: -rw-r--r-- 1,047 bytes parent folder | download | duplicates (2)
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
=== 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" {
    export function foo(s: string): void;
>foo : (s: string) => void
>s : string
}
// Augmentations still work
declare module "foo*baz" {
    export const baz: string;
>baz : string
}

// Longest prefix wins
declare module "foos*" {
    export const foos: string;
>foos : string
}

declare module "*!text" {
    const x: string;
>x : string

    export default x;
>x : string
}