104 lines
2.1 KiB
Plaintext
104 lines
2.1 KiB
Plaintext
=== tests/cases/conformance/externalModules/a.ts ===
|
|
/// <reference path="node_modules/math2d/index.d.ts" />
|
|
/// <reference path="math2d-augment.d.ts" />
|
|
let v = new Math2d.Vector(3, 2);
|
|
>v : Vector
|
|
>new Math2d.Vector(3, 2) : Vector
|
|
>Math2d.Vector : typeof Math2d.Vector
|
|
>Math2d : typeof Math2d
|
|
>Vector : typeof Math2d.Vector
|
|
>3 : 3
|
|
>2 : 2
|
|
|
|
let magnitude = Math2d.getLength(v);
|
|
>magnitude : number
|
|
>Math2d.getLength(v) : number
|
|
>Math2d.getLength : (p: Vector) => number
|
|
>Math2d : typeof Math2d
|
|
>getLength : (p: Vector) => number
|
|
>v : Vector
|
|
|
|
let p: Math2d.Point = v.translate(5, 5);
|
|
>p : Math2d.Point
|
|
>Math2d : any
|
|
>Point : Math2d.Point
|
|
>v.translate(5, 5) : Vector
|
|
>v.translate : (dx: number, dy: number) => Vector
|
|
>v : Vector
|
|
>translate : (dx: number, dy: number) => Vector
|
|
>5 : 5
|
|
>5 : 5
|
|
|
|
p = v.reverse();
|
|
>p = v.reverse() : Math2d.Point
|
|
>p : Math2d.Point
|
|
>v.reverse() : Math2d.Point
|
|
>v.reverse : () => Math2d.Point
|
|
>v : Vector
|
|
>reverse : () => Math2d.Point
|
|
|
|
var t = p.x;
|
|
>t : number
|
|
>p.x : number
|
|
>p : Math2d.Point
|
|
>x : number
|
|
|
|
=== tests/cases/conformance/externalModules/node_modules/math2d/index.d.ts ===
|
|
|
|
export as namespace Math2d;
|
|
>Math2d : typeof Math2d
|
|
|
|
export interface Point {
|
|
>Point : Point
|
|
|
|
x: number;
|
|
>x : number
|
|
|
|
y: number;
|
|
>y : number
|
|
}
|
|
|
|
export class Vector implements Point {
|
|
>Vector : Vector
|
|
>Point : Point
|
|
|
|
x: number;
|
|
>x : number
|
|
|
|
y: number;
|
|
>y : number
|
|
|
|
constructor(x: number, y: number);
|
|
>x : number
|
|
>y : number
|
|
|
|
translate(dx: number, dy: number): Vector;
|
|
>translate : (dx: number, dy: number) => Vector
|
|
>dx : number
|
|
>dy : number
|
|
>Vector : Vector
|
|
}
|
|
|
|
export function getLength(p: Vector): number;
|
|
>getLength : (p: Vector) => number
|
|
>p : Vector
|
|
>Vector : Vector
|
|
|
|
=== tests/cases/conformance/externalModules/math2d-augment.d.ts ===
|
|
import * as Math2d from 'math2d';
|
|
>Math2d : typeof Math2d
|
|
|
|
// Augment the module
|
|
declare module 'math2d' {
|
|
// Add a method to the class
|
|
interface Vector {
|
|
>Vector : Vector
|
|
|
|
reverse(): Math2d.Point;
|
|
>reverse : () => Point
|
|
>Math2d : any
|
|
>Point : Point
|
|
}
|
|
}
|
|
|