Skip to content

Commit f7a55fa

Browse files
author
Kanchalai Tanglertsampan
committed
Remove --lib
1 parent 92bee6a commit f7a55fa

3 files changed

Lines changed: 12 additions & 349 deletions

File tree

src/compiler/commandLineParser.ts

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -262,39 +262,6 @@ namespace ts {
262262
},
263263
description: Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6,
264264
},
265-
{
266-
name: "lib",
267-
type: "list",
268-
element: {
269-
name: "lib",
270-
type: {
271-
// JavaScript only
272-
"es5": "lib.es5.d.ts",
273-
"es6": "lib.es6.d.ts",
274-
"es7": "lib.es7.d.ts",
275-
// Host only
276-
"dom": "lib.dom.d.ts",
277-
"webworker": "lib.webworker.d.ts",
278-
"scripthost": "lib.scripthost.d.ts",
279-
// ES6 Or ESNext By-feature options
280-
"es6.array": "lib.es6.array.d.ts",
281-
"es6.collection": "lib.es6.collection.d.ts",
282-
"es6.function": "lib.es6.function.d.ts",
283-
"es6.iterable": "lib.es6.iterable.d.ts",
284-
"es6.math": "lib.es6.math.d.ts",
285-
"es6.number": "lib.es6.number.d.ts",
286-
"es6.object": "lib.es6.object.d.ts",
287-
"es6.promise": "lib.es6.promise.d.ts",
288-
"es6.proxy": "lib.es6.proxy.d.ts",
289-
"es6.reflect": "lib.es6.reflect.d.ts",
290-
"es6.regexp": "lib.es6.regexp.d.ts",
291-
"es6.symbol": "lib.es6.symbol.d.ts",
292-
"es6.symbol.wellknown": "lib.es6.symbol.wellknown.d.ts",
293-
"es7.array.include": "lib.es7.array.include.d.ts"
294-
},
295-
},
296-
description: Diagnostics.Specify_library_to_be_included_in_the_compilation_Colon,
297-
},
298265
{
299266
name: "allowUnusedLabels",
300267
type: "boolean",
@@ -385,7 +352,7 @@ namespace ts {
385352
name: "exclude",
386353
type: "list",
387354
element: {
388-
name: "include",
355+
name: "exclude",
389356
type: "string"
390357
}
391358
}

tests/cases/unittests/commandLineParsing.ts

Lines changed: 11 additions & 159 deletions
Original file line numberDiff line numberDiff line change
@@ -31,52 +31,8 @@ namespace ts {
3131
}
3232
}
3333

34-
it("Parse single option of library flag ", () => {
35-
// --lib es6 0.ts
36-
assertParseResult(["--lib", "es6", "0.ts"],
37-
{
38-
errors: [],
39-
fileNames: ["0.ts"],
40-
options: {
41-
lib: ["lib.es6.d.ts"]
42-
}
43-
});
44-
});
45-
46-
it("Parse multiple options of library flags ", () => {
47-
// --lib es5,es6.symbol.wellknown 0.ts
48-
assertParseResult(["--lib", "es5,es6.symbol.wellknown", "0.ts"],
49-
{
50-
errors: [],
51-
fileNames: ["0.ts"],
52-
options: {
53-
lib: ["lib.es5.d.ts", "lib.es6.symbol.wellknown.d.ts"]
54-
}
55-
});
56-
});
57-
58-
it("Parse unavailable options of library flags ", () => {
59-
// --lib es5,es7 0.ts
60-
assertParseResult(["--lib", "es5,es8", "0.ts"],
61-
{
62-
errors: [{
63-
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es7', 'dom', 'webworker', 'scripthost', 'es6.array', 'es6.collection', 'es6.function', 'es6.iterable', 'es6.math', 'es6.number', 'es6.object', 'es6.promise', 'es6.proxy', 'es6.reflect', 'es6.regexp', 'es6.symbol', 'es6.symbol.wellknown', 'es7.array.include'",
64-
category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
65-
code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
66-
67-
file: undefined,
68-
start: undefined,
69-
length: undefined,
70-
}],
71-
fileNames: ["0.ts"],
72-
options: {
73-
lib: ["lib.es5.d.ts"]
74-
}
75-
});
76-
});
77-
7834
it("Parse empty options of --jsx ", () => {
79-
// 0.ts --lib
35+
// 0.ts --jsx
8036
assertParseResult(["0.ts", "--jsx"],
8137
{
8238
errors: [{
@@ -102,7 +58,7 @@ namespace ts {
10258
});
10359

10460
it("Parse empty options of --module ", () => {
105-
// 0.ts --lib
61+
// 0.ts --
10662
assertParseResult(["0.ts", "--module"],
10763
{
10864
errors: [{
@@ -128,7 +84,7 @@ namespace ts {
12884
});
12985

13086
it("Parse empty options of --newLine ", () => {
131-
// 0.ts --lib
87+
// 0.ts --newLine
13288
assertParseResult(["0.ts", "--newLine"],
13389
{
13490
errors: [{
@@ -154,7 +110,7 @@ namespace ts {
154110
});
155111

156112
it("Parse empty options of --target ", () => {
157-
// 0.ts --lib
113+
// 0.ts --target
158114
assertParseResult(["0.ts", "--target"],
159115
{
160116
errors: [{
@@ -180,7 +136,7 @@ namespace ts {
180136
});
181137

182138
it("Parse empty options of --moduleResolution ", () => {
183-
// 0.ts --lib
139+
// 0.ts --moduleResolution
184140
assertParseResult(["0.ts", "--moduleResolution"],
185141
{
186142
errors: [{
@@ -205,133 +161,29 @@ namespace ts {
205161
});
206162
});
207163

208-
it("Parse empty options of --lib ", () => {
209-
// 0.ts --lib
210-
assertParseResult(["0.ts", "--lib"],
211-
{
212-
errors: [{
213-
messageText: "Compiler option 'lib' expects an argument.",
214-
category: ts.Diagnostics.Compiler_option_0_expects_an_argument.category,
215-
code: ts.Diagnostics.Compiler_option_0_expects_an_argument.code,
216-
217-
file: undefined,
218-
start: undefined,
219-
length: undefined,
220-
}, {
221-
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es7', 'dom', 'webworker', 'scripthost', 'es6.array', 'es6.collection', 'es6.function', 'es6.iterable', 'es6.math', 'es6.number', 'es6.object', 'es6.promise', 'es6.proxy', 'es6.reflect', 'es6.regexp', 'es6.symbol', 'es6.symbol.wellknown', 'es7.array.include'",
222-
category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
223-
code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
224-
225-
file: undefined,
226-
start: undefined,
227-
length: undefined,
228-
}],
229-
fileNames: ["0.ts"],
230-
options: {
231-
lib: []
232-
}
233-
});
234-
});
235-
236-
it("Parse --lib option with extra comma ", () => {
237-
// --lib es5, es7 0.ts
238-
assertParseResult(["--lib", "es5,", "es7", "0.ts"],
239-
{
240-
errors: [{
241-
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es7', 'dom', 'webworker', 'scripthost', 'es6.array', 'es6.collection', 'es6.function', 'es6.iterable', 'es6.math', 'es6.number', 'es6.object', 'es6.promise', 'es6.proxy', 'es6.reflect', 'es6.regexp', 'es6.symbol', 'es6.symbol.wellknown', 'es7.array.include'",
242-
category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
243-
code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
244-
245-
file: undefined,
246-
start: undefined,
247-
length: undefined,
248-
}],
249-
fileNames: ["es7", "0.ts"],
250-
options: {
251-
lib: ["lib.es5.d.ts"]
252-
}
253-
});
254-
});
255-
256-
it("Parse --lib option with trailing white-space ", () => {
257-
// --lib es5, es7 0.ts
258-
assertParseResult(["--lib", "es5, ", "es7", "0.ts"],
259-
{
260-
errors: [{
261-
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es7', 'dom', 'webworker', 'scripthost', 'es6.array', 'es6.collection', 'es6.function', 'es6.iterable', 'es6.math', 'es6.number', 'es6.object', 'es6.promise', 'es6.proxy', 'es6.reflect', 'es6.regexp', 'es6.symbol', 'es6.symbol.wellknown', 'es7.array.include'",
262-
category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
263-
code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
264-
265-
file: undefined,
266-
start: undefined,
267-
length: undefined,
268-
}],
269-
fileNames: ["es7", "0.ts"],
270-
options: {
271-
lib: ["lib.es5.d.ts"]
272-
}
273-
});
274-
});
275-
276164
it("Parse multiple compiler flags with input files at the end", () => {
277-
// --lib es5,es6.symbol.wellknown --target es5 0.ts
278-
assertParseResult(["--lib", "es5,es6.symbol.wellknown", "--target", "es5", "0.ts"],
279-
{
280-
errors: [],
281-
fileNames: ["0.ts"],
282-
options: {
283-
lib: ["lib.es5.d.ts", "lib.es6.symbol.wellknown.d.ts"],
284-
target: ts.ScriptTarget.ES5,
285-
}
286-
});
287-
});
288-
289-
it("Parse multiple compiler flags with input files in the middle", () => {
290-
// --module commonjs --target es5 0.ts --lib es5,es6.symbol.wellknown
291-
assertParseResult(["--module", "commonjs", "--target", "es5", "0.ts", "--lib", "es5,es6.symbol.wellknown"],
165+
// --module commonjs --target es5 0.ts
166+
assertParseResult(["--module", "commonjs", "--target", "es5", "0.ts"],
292167
{
293168
errors: [],
294169
fileNames: ["0.ts"],
295170
options: {
296171
module: ts.ModuleKind.CommonJS,
297172
target: ts.ScriptTarget.ES5,
298-
lib: ["lib.es5.d.ts", "lib.es6.symbol.wellknown.d.ts"],
299173
}
300174
});
301175
});
302176

303-
it("Parse --lib as the last arguments", () => {
304-
// --module commonjs --target es5 0.ts --lib es5, es6.symbol.wellknown
305-
assertParseResult(["--module", "commonjs", "--target", "es5", "0.ts", "--lib", "es5,", "es6.symbol.wellknown"],
306-
{
307-
errors: [{
308-
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es7', 'dom', 'webworker', 'scripthost', 'es6.array', 'es6.collection', 'es6.function', 'es6.iterable', 'es6.math', 'es6.number', 'es6.object', 'es6.promise', 'es6.proxy', 'es6.reflect', 'es6.regexp', 'es6.symbol', 'es6.symbol.wellknown', 'es7.array.include'",
309-
category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
310-
code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
311-
312-
file: undefined,
313-
start: undefined,
314-
length: undefined,
315-
}],
316-
fileNames: ["0.ts", "es6.symbol.wellknown"],
317-
options: {
318-
module: ts.ModuleKind.CommonJS,
319-
target: ts.ScriptTarget.ES5,
320-
lib: ["lib.es5.d.ts"],
321-
}
322-
});
323-
});
324-
325-
it("Parse multiple library compiler flags ", () => {
326-
// --module commonjs --target es5 --lib es5 0.ts --library es6.array,es6.symbol.wellknown
327-
assertParseResult(["--module", "commonjs", "--target", "es5", "--lib", "es5", "0.ts", "--lib", "es6.array,es6.symbol.wellknown"],
177+
it("Parse multiple compiler flags with input files in the middle", () => {
178+
// --module commonjs --target es5 0.ts --noImplicitAny
179+
assertParseResult(["--module", "commonjs", "--target", "es5", "0.ts", "--noImplicitAny"],
328180
{
329181
errors: [],
330182
fileNames: ["0.ts"],
331183
options: {
332184
module: ts.ModuleKind.CommonJS,
333185
target: ts.ScriptTarget.ES5,
334-
lib: ["lib.es6.array.d.ts", "lib.es6.symbol.wellknown.d.ts"],
186+
noImplicitAny: true,
335187
}
336188
});
337189
});

0 commit comments

Comments
 (0)