TypeScript/tests/cases/compiler/modularizeLibrary_NoErrorDuplicateLibOptions2.ts
Yui 11887ccc29 Adjustmodularize lib
* Merge array, function, math, number, object, regexp, string into es2015.core

* Update baselines

* Add node.d.ts; need to fix head of the output

* Update unittests from add node as an option for --lib

* Move interface declaration into NodeJS namespace

* Add console into Node.d.ts

* Add compiler baseline-tests for using --lib node

* Change name from full.es2015 to es6. This is a es6 library file used when no --lib is specified and --target is es6

* Remove add node.d.ts into src/lib

Remove node.d.ts

Revert "Update unittests from add node as an option for --lib"

This reverts commit 5169273680.

Revert "Add compiler baseline-tests for using --lib node"

This reverts commit 17e437b4c7.
2016-04-04 22:02:12 -07:00

83 lines
1.4 KiB
TypeScript

// @lib: es5,es2015,es2015.core,es2015.symbol.wellknown
// @target: es6
// Using Es6 array
function f(x: number, y: number, z: number) {
return Array.from(arguments);
}
f(1, 2, 3); // no error
// Using ES6 collection
var m = new Map<string, number>();
m.clear();
// Using ES6 iterable
m.keys();
// Using ES6 function
function Baz() { }
Baz.name;
// Using ES6 generator
function* gen() {
let i = 0;
while (i < 10) {
yield i;
i++;
}
}
function* gen2() {
let i = 0;
while (i < 10) {
yield i;
i++;
}
}
// Using ES6 math
Math.sign(1);
// Using ES6 object
var o = {
a: 2,
[Symbol.hasInstance](value: any) {
return false;
}
};
o.hasOwnProperty(Symbol.hasInstance);
// Using ES6 promise
async function out() {
return new Promise(function (resolve, reject) {});
}
declare var console: any;
out().then(() => {
console.log("Yea!");
});
// Using Es6 proxy
var t = {}
var p = new Proxy(t, {});
// Using ES6 reflect
Reflect.isExtensible({});
// Using Es6 regexp
var reg = new RegExp("/s");
reg.flags;
// Using ES6 string
var str = "Hello world";
str.includes("hello", 0);
// Using ES6 symbol
var s = Symbol();
// Using ES6 wellknown-symbol
const o1 = {
[Symbol.hasInstance](value: any) {
return false;
}
}