mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-11 19:27:35 -06:00
Add tests for noLib with <reference lib>.
This commit is contained in:
parent
11b150129a
commit
cc7ddaed28
51
tests/baselines/reference/libReferenceNoLib.js
Normal file
51
tests/baselines/reference/libReferenceNoLib.js
Normal file
@ -0,0 +1,51 @@
|
||||
//// [tests/cases/conformance/declarationEmit/libReferenceNoLib.ts] ////
|
||||
|
||||
//// [fakelib.ts]
|
||||
// Test that passing noLib disables <reference lib> resolution.
|
||||
|
||||
interface Object { }
|
||||
interface Array<T> { }
|
||||
interface String { }
|
||||
interface Boolean { }
|
||||
interface Number { }
|
||||
interface Function { }
|
||||
interface RegExp { }
|
||||
interface IArguments { }
|
||||
|
||||
|
||||
//// [file1.ts]
|
||||
/// <reference lib="dom" />
|
||||
export declare interface HTMLElement { field: string; }
|
||||
export const elem: HTMLElement = { field: 'a' };
|
||||
|
||||
|
||||
//// [fakelib.js]
|
||||
// Test that passing noLib disables <reference lib> resolution.
|
||||
//// [file1.js]
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.elem = { field: 'a' };
|
||||
|
||||
|
||||
//// [fakelib.d.ts]
|
||||
interface Object {
|
||||
}
|
||||
interface Array<T> {
|
||||
}
|
||||
interface String {
|
||||
}
|
||||
interface Boolean {
|
||||
}
|
||||
interface Number {
|
||||
}
|
||||
interface Function {
|
||||
}
|
||||
interface RegExp {
|
||||
}
|
||||
interface IArguments {
|
||||
}
|
||||
//// [file1.d.ts]
|
||||
export declare interface HTMLElement {
|
||||
field: string;
|
||||
}
|
||||
export declare const elem: HTMLElement;
|
||||
40
tests/baselines/reference/libReferenceNoLib.symbols
Normal file
40
tests/baselines/reference/libReferenceNoLib.symbols
Normal file
@ -0,0 +1,40 @@
|
||||
=== tests/cases/conformance/declarationEmit/fakelib.ts ===
|
||||
// Test that passing noLib disables <reference lib> resolution.
|
||||
|
||||
interface Object { }
|
||||
>Object : Symbol(Object, Decl(fakelib.ts, 0, 0))
|
||||
|
||||
interface Array<T> { }
|
||||
>Array : Symbol(Array, Decl(fakelib.ts, 2, 20))
|
||||
>T : Symbol(T, Decl(fakelib.ts, 3, 16))
|
||||
|
||||
interface String { }
|
||||
>String : Symbol(String, Decl(fakelib.ts, 3, 22))
|
||||
|
||||
interface Boolean { }
|
||||
>Boolean : Symbol(Boolean, Decl(fakelib.ts, 4, 20))
|
||||
|
||||
interface Number { }
|
||||
>Number : Symbol(Number, Decl(fakelib.ts, 5, 21))
|
||||
|
||||
interface Function { }
|
||||
>Function : Symbol(Function, Decl(fakelib.ts, 6, 20))
|
||||
|
||||
interface RegExp { }
|
||||
>RegExp : Symbol(RegExp, Decl(fakelib.ts, 7, 22))
|
||||
|
||||
interface IArguments { }
|
||||
>IArguments : Symbol(IArguments, Decl(fakelib.ts, 8, 20))
|
||||
|
||||
|
||||
=== tests/cases/conformance/declarationEmit/file1.ts ===
|
||||
/// <reference lib="dom" />
|
||||
export declare interface HTMLElement { field: string; }
|
||||
>HTMLElement : Symbol(HTMLElement, Decl(file1.ts, 0, 0))
|
||||
>field : Symbol(HTMLElement.field, Decl(file1.ts, 1, 38))
|
||||
|
||||
export const elem: HTMLElement = { field: 'a' };
|
||||
>elem : Symbol(elem, Decl(file1.ts, 2, 12))
|
||||
>HTMLElement : Symbol(HTMLElement, Decl(file1.ts, 0, 0))
|
||||
>field : Symbol(field, Decl(file1.ts, 2, 34))
|
||||
|
||||
24
tests/baselines/reference/libReferenceNoLib.types
Normal file
24
tests/baselines/reference/libReferenceNoLib.types
Normal file
@ -0,0 +1,24 @@
|
||||
=== tests/cases/conformance/declarationEmit/fakelib.ts ===
|
||||
// Test that passing noLib disables <reference lib> resolution.
|
||||
No type information for this code.
|
||||
No type information for this code.interface Object { }
|
||||
No type information for this code.interface Array<T> { }
|
||||
No type information for this code.interface String { }
|
||||
No type information for this code.interface Boolean { }
|
||||
No type information for this code.interface Number { }
|
||||
No type information for this code.interface Function { }
|
||||
No type information for this code.interface RegExp { }
|
||||
No type information for this code.interface IArguments { }
|
||||
No type information for this code.
|
||||
No type information for this code.
|
||||
No type information for this code.=== tests/cases/conformance/declarationEmit/file1.ts ===
|
||||
/// <reference lib="dom" />
|
||||
export declare interface HTMLElement { field: string; }
|
||||
>field : string
|
||||
|
||||
export const elem: HTMLElement = { field: 'a' };
|
||||
>elem : HTMLElement
|
||||
>{ field: 'a' } : { field: string; }
|
||||
>field : string
|
||||
>'a' : "a"
|
||||
|
||||
21
tests/cases/conformance/declarationEmit/libReferenceNoLib.ts
Normal file
21
tests/cases/conformance/declarationEmit/libReferenceNoLib.ts
Normal file
@ -0,0 +1,21 @@
|
||||
// @target: esnext
|
||||
// @module: commonjs
|
||||
// @noLib: true
|
||||
// @declaration: true
|
||||
// Test that passing noLib disables <reference lib> resolution.
|
||||
|
||||
// @filename: fakelib.ts
|
||||
interface Object { }
|
||||
interface Array<T> { }
|
||||
interface String { }
|
||||
interface Boolean { }
|
||||
interface Number { }
|
||||
interface Function { }
|
||||
interface RegExp { }
|
||||
interface IArguments { }
|
||||
|
||||
|
||||
// @filename: file1.ts
|
||||
/// <reference lib="dom" />
|
||||
export declare interface HTMLElement { field: string; }
|
||||
export const elem: HTMLElement = { field: 'a' };
|
||||
Loading…
x
Reference in New Issue
Block a user