Accepted baselines.

This commit is contained in:
Daniel Rosenwasser 2018-04-10 16:29:05 -07:00
parent 4f497e6c0c
commit 1ea269af87
8 changed files with 594 additions and 1 deletions

View file

@ -1,4 +1,5 @@
error TS2468: Cannot find global value 'Promise'.
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(2,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/conformance/es2019/importMeta/example.ts(2,2): error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option.
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(2,23): error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(3,23): error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
@ -41,4 +42,18 @@ tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS
let globalC = import.import.import.malkovich;
~~~~~~
!!! error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
==== tests/cases/conformance/es2019/importMeta/assignmentTargets.ts (1 errors) ====
export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta;
import.meta = foo;
~~~~~~~~~~~
!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
// @Filename augmentations.ts
declare global {
interface ImportMeta {
wellKnownProperty: { a: number, b: string, c: boolean };
}
}
const { a, b, c } = import.meta.wellKnownProperty;

View file

@ -25,6 +25,18 @@ let globalA = import.meta;
let globalB = import.metal;
let globalC = import.import.import.malkovich;
//// [assignmentTargets.ts]
export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta;
import.meta = foo;
// @Filename augmentations.ts
declare global {
interface ImportMeta {
wellKnownProperty: { a: number, b: string, c: boolean };
}
}
const { a, b, c } = import.meta.wellKnownProperty;
//// [example.js]
// Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example
@ -45,3 +57,7 @@ export let z = import.import.import.malkovich;
let globalA = import.meta;
let globalB = import.metal;
let globalC = import.import.import.malkovich;
//// [assignmentTargets.js]
export const foo = import.meta.blah = import.meta.blue = import.meta;
import.meta = foo;
const { a, b, c } = import.meta.wellKnownProperty;

View file

@ -69,3 +69,33 @@ let globalB = import.metal;
let globalC = import.import.import.malkovich;
>globalC : Symbol(globalC, Decl(scriptLookingFile01.ts, 2, 3))
=== tests/cases/conformance/es2019/importMeta/assignmentTargets.ts ===
export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta;
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
import.meta = foo;
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
// @Filename augmentations.ts
declare global {
>global : Symbol(global, Decl(assignmentTargets.ts, 1, 18))
interface ImportMeta {
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
wellKnownProperty: { a: number, b: string, c: boolean };
>wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24))
>a : Symbol(a, Decl(assignmentTargets.ts, 6, 24))
>b : Symbol(b, Decl(assignmentTargets.ts, 6, 35))
>c : Symbol(c, Decl(assignmentTargets.ts, 6, 46))
}
}
const { a, b, c } = import.meta.wellKnownProperty;
>a : Symbol(a, Decl(assignmentTargets.ts, 10, 7))
>b : Symbol(b, Decl(assignmentTargets.ts, 10, 10))
>c : Symbol(c, Decl(assignmentTargets.ts, 10, 13))
>import.meta.wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24))
>wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24))

View file

@ -120,3 +120,50 @@ let globalC = import.import.import.malkovich;
>import : any
>malkovich : any
=== tests/cases/conformance/es2019/importMeta/assignmentTargets.ts ===
export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta;
>foo : ImportMeta
>ImportMeta : ImportMeta
>import.meta.blah = import.meta.blue = import.meta : ImportMeta
>import.meta.blah : any
>import.meta : ImportMeta
>meta : any
>blah : any
>import.meta.blue = import.meta : ImportMeta
>import.meta.blue : any
>import.meta : ImportMeta
>meta : any
>blue : any
>import.meta : ImportMeta
>meta : any
import.meta = foo;
>import.meta = foo : ImportMeta
>import.meta : ImportMeta
>meta : any
>foo : ImportMeta
// @Filename augmentations.ts
declare global {
>global : any
interface ImportMeta {
>ImportMeta : ImportMeta
wellKnownProperty: { a: number, b: string, c: boolean };
>wellKnownProperty : { a: number; b: string; c: boolean; }
>a : number
>b : string
>c : boolean
}
}
const { a, b, c } = import.meta.wellKnownProperty;
>a : number
>b : string
>c : boolean
>import.meta.wellKnownProperty : { a: number; b: string; c: boolean; }
>import.meta : ImportMeta
>meta : any
>wellKnownProperty : { a: number; b: string; c: boolean; }

View file

@ -0,0 +1,98 @@
error TS2468: Cannot find global value 'Promise'.
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,32): error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options.
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,51): error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options.
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,70): error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options.
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(2,1): error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options.
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(2,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(11,21): error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options.
tests/cases/conformance/es2019/importMeta/example.ts(2,2): error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option.
tests/cases/conformance/es2019/importMeta/example.ts(3,59): error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options.
tests/cases/conformance/es2019/importMeta/example.ts(6,16): error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options.
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(1,16): error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options.
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(2,16): error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options.
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(2,23): error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(3,16): error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options.
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(3,23): error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(1,15): error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options.
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(2,15): error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options.
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(2,22): error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,15): error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options.
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
!!! error TS2468: Cannot find global value 'Promise'.
==== tests/cases/conformance/es2019/importMeta/example.ts (3 errors) ====
// Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example
(async () => {
~~~~~~~~~~~~~
!!! error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option.
const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString());
~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options.
const blob = await response.blob();
const size = import.meta.scriptElement.dataset.size || 300;
~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options.
const image = new Image();
image.src = URL.createObjectURL(blob);
image.width = image.height = size;
document.body.appendChild(image);
})();
==== tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts (5 errors) ====
export let x = import.meta;
~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options.
export let y = import.metal;
~~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options.
~~~~~
!!! error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
export let z = import.import.import.malkovich;
~~~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options.
~~~~~~
!!! error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
==== tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts (5 errors) ====
let globalA = import.meta;
~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options.
let globalB = import.metal;
~~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options.
~~~~~
!!! error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
let globalC = import.import.import.malkovich;
~~~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options.
~~~~~~
!!! error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
==== tests/cases/conformance/es2019/importMeta/assignmentTargets.ts (6 errors) ====
export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta;
~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options.
~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options.
~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options.
import.meta = foo;
~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options.
~~~~~~~~~~~
!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
// @Filename augmentations.ts
declare global {
interface ImportMeta {
wellKnownProperty: { a: number, b: string, c: boolean };
}
}
const { a, b, c } = import.meta.wellKnownProperty;
~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options.

View file

@ -0,0 +1,117 @@
//// [tests/cases/conformance/es2019/importMeta/importMetaES5.ts] ////
//// [example.ts]
// Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example
(async () => {
const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString());
const blob = await response.blob();
const size = import.meta.scriptElement.dataset.size || 300;
const image = new Image();
image.src = URL.createObjectURL(blob);
image.width = image.height = size;
document.body.appendChild(image);
})();
//// [moduleLookingFile01.ts]
export let x = import.meta;
export let y = import.metal;
export let z = import.import.import.malkovich;
//// [scriptLookingFile01.ts]
let globalA = import.meta;
let globalB = import.metal;
let globalC = import.import.import.malkovich;
//// [assignmentTargets.ts]
export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta;
import.meta = foo;
// @Filename augmentations.ts
declare global {
interface ImportMeta {
wellKnownProperty: { a: number, b: string, c: boolean };
}
}
const { a, b, c } = import.meta.wellKnownProperty;
//// [example.js]
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var _this = this;
Object.defineProperty(exports, "__esModule", { value: true });
// Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example
(function () { return __awaiter(_this, void 0, void 0, function () {
var response, blob, size, image;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, fetch(new URL("../hamsters.jpg", import.meta.url).toString())];
case 1:
response = _a.sent();
return [4 /*yield*/, response.blob()];
case 2:
blob = _a.sent();
size = import.meta.scriptElement.dataset.size || 300;
image = new Image();
image.src = URL.createObjectURL(blob);
image.width = image.height = size;
document.body.appendChild(image);
return [2 /*return*/];
}
});
}); })();
//// [moduleLookingFile01.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.x = (import.meta);
exports.y = (import.metal);
exports.z = import.import.import.malkovich;
//// [scriptLookingFile01.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var globalA = import.meta;
var globalB = import.metal;
var globalC = import.import.import.malkovich;
//// [assignmentTargets.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.foo = import.meta.blah = import.meta.blue = import.meta;
import.meta = exports.foo;
var _a = import.meta.wellKnownProperty, a = _a.a, b = _a.b, c = _a.c;

View file

@ -0,0 +1,101 @@
=== tests/cases/conformance/es2019/importMeta/example.ts ===
// Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example
(async () => {
const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString());
>response : Symbol(response, Decl(example.ts, 2, 7))
>fetch : Symbol(fetch, Decl(lib.dom.d.ts, --, --))
>new URL("../hamsters.jpg", import.meta.url).toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --))
>URL : Symbol(URL, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --))
>toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --))
const blob = await response.blob();
>blob : Symbol(blob, Decl(example.ts, 3, 7))
>response.blob : Symbol(Body.blob, Decl(lib.dom.d.ts, --, --))
>response : Symbol(response, Decl(example.ts, 2, 7))
>blob : Symbol(Body.blob, Decl(lib.dom.d.ts, --, --))
const size = import.meta.scriptElement.dataset.size || 300;
>size : Symbol(size, Decl(example.ts, 5, 7))
const image = new Image();
>image : Symbol(image, Decl(example.ts, 7, 7))
>Image : Symbol(Image, Decl(lib.dom.d.ts, --, --))
image.src = URL.createObjectURL(blob);
>image.src : Symbol(HTMLImageElement.src, Decl(lib.dom.d.ts, --, --))
>image : Symbol(image, Decl(example.ts, 7, 7))
>src : Symbol(HTMLImageElement.src, Decl(lib.dom.d.ts, --, --))
>URL.createObjectURL : Symbol(createObjectURL, Decl(lib.dom.d.ts, --, --))
>URL : Symbol(URL, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --))
>createObjectURL : Symbol(createObjectURL, Decl(lib.dom.d.ts, --, --))
>blob : Symbol(blob, Decl(example.ts, 3, 7))
image.width = image.height = size;
>image.width : Symbol(HTMLImageElement.width, Decl(lib.dom.d.ts, --, --))
>image : Symbol(image, Decl(example.ts, 7, 7))
>width : Symbol(HTMLImageElement.width, Decl(lib.dom.d.ts, --, --))
>image.height : Symbol(HTMLImageElement.height, Decl(lib.dom.d.ts, --, --))
>image : Symbol(image, Decl(example.ts, 7, 7))
>height : Symbol(HTMLImageElement.height, Decl(lib.dom.d.ts, --, --))
>size : Symbol(size, Decl(example.ts, 5, 7))
document.body.appendChild(image);
>document.body.appendChild : Symbol(Node.appendChild, Decl(lib.dom.d.ts, --, --))
>document.body : Symbol(Document.body, Decl(lib.dom.d.ts, --, --))
>document : Symbol(document, Decl(lib.dom.d.ts, --, --))
>body : Symbol(Document.body, Decl(lib.dom.d.ts, --, --))
>appendChild : Symbol(Node.appendChild, Decl(lib.dom.d.ts, --, --))
>image : Symbol(image, Decl(example.ts, 7, 7))
})();
=== tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts ===
export let x = import.meta;
>x : Symbol(x, Decl(moduleLookingFile01.ts, 0, 10))
export let y = import.metal;
>y : Symbol(y, Decl(moduleLookingFile01.ts, 1, 10))
export let z = import.import.import.malkovich;
>z : Symbol(z, Decl(moduleLookingFile01.ts, 2, 10))
=== tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts ===
let globalA = import.meta;
>globalA : Symbol(globalA, Decl(scriptLookingFile01.ts, 0, 3))
let globalB = import.metal;
>globalB : Symbol(globalB, Decl(scriptLookingFile01.ts, 1, 3))
let globalC = import.import.import.malkovich;
>globalC : Symbol(globalC, Decl(scriptLookingFile01.ts, 2, 3))
=== tests/cases/conformance/es2019/importMeta/assignmentTargets.ts ===
export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta;
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
import.meta = foo;
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
// @Filename augmentations.ts
declare global {
>global : Symbol(global, Decl(assignmentTargets.ts, 1, 18))
interface ImportMeta {
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
wellKnownProperty: { a: number, b: string, c: boolean };
>wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24))
>a : Symbol(a, Decl(assignmentTargets.ts, 6, 24))
>b : Symbol(b, Decl(assignmentTargets.ts, 6, 35))
>c : Symbol(c, Decl(assignmentTargets.ts, 6, 46))
}
}
const { a, b, c } = import.meta.wellKnownProperty;
>a : Symbol(a, Decl(assignmentTargets.ts, 10, 7))
>b : Symbol(b, Decl(assignmentTargets.ts, 10, 10))
>c : Symbol(c, Decl(assignmentTargets.ts, 10, 13))
>import.meta.wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24))
>wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24))

View file

@ -0,0 +1,169 @@
=== tests/cases/conformance/es2019/importMeta/example.ts ===
// Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example
(async () => {
>(async () => { const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString()); const blob = await response.blob(); const size = import.meta.scriptElement.dataset.size || 300; const image = new Image(); image.src = URL.createObjectURL(blob); image.width = image.height = size; document.body.appendChild(image);})() : Promise<void>
>(async () => { const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString()); const blob = await response.blob(); const size = import.meta.scriptElement.dataset.size || 300; const image = new Image(); image.src = URL.createObjectURL(blob); image.width = image.height = size; document.body.appendChild(image);}) : () => Promise<void>
>async () => { const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString()); const blob = await response.blob(); const size = import.meta.scriptElement.dataset.size || 300; const image = new Image(); image.src = URL.createObjectURL(blob); image.width = image.height = size; document.body.appendChild(image);} : () => Promise<void>
const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString());
>response : Response
>await fetch(new URL("../hamsters.jpg", import.meta.url).toString()) : Response
>fetch(new URL("../hamsters.jpg", import.meta.url).toString()) : Promise<Response>
>fetch : (input?: string | Request, init?: RequestInit) => Promise<Response>
>new URL("../hamsters.jpg", import.meta.url).toString() : string
>new URL("../hamsters.jpg", import.meta.url).toString : () => string
>new URL("../hamsters.jpg", import.meta.url) : URL
>URL : { new (url: string, base?: string | URL): URL; prototype: URL; createObjectURL(object: any, options?: ObjectURLOptions): string; revokeObjectURL(url: string): void; }
>"../hamsters.jpg" : "../hamsters.jpg"
>import.meta.url : any
>import.meta : ImportMeta
>meta : any
>url : any
>toString : () => string
const blob = await response.blob();
>blob : Blob
>await response.blob() : Blob
>response.blob() : Promise<Blob>
>response.blob : () => Promise<Blob>
>response : Response
>blob : () => Promise<Blob>
const size = import.meta.scriptElement.dataset.size || 300;
>size : any
>import.meta.scriptElement.dataset.size || 300 : any
>import.meta.scriptElement.dataset.size : any
>import.meta.scriptElement.dataset : any
>import.meta.scriptElement : any
>import.meta : ImportMeta
>meta : any
>scriptElement : any
>dataset : any
>size : any
>300 : 300
const image = new Image();
>image : HTMLImageElement
>new Image() : HTMLImageElement
>Image : new (width?: number, height?: number) => HTMLImageElement
image.src = URL.createObjectURL(blob);
>image.src = URL.createObjectURL(blob) : string
>image.src : string
>image : HTMLImageElement
>src : string
>URL.createObjectURL(blob) : string
>URL.createObjectURL : (object: any, options?: ObjectURLOptions) => string
>URL : { new (url: string, base?: string | URL): URL; prototype: URL; createObjectURL(object: any, options?: ObjectURLOptions): string; revokeObjectURL(url: string): void; }
>createObjectURL : (object: any, options?: ObjectURLOptions) => string
>blob : Blob
image.width = image.height = size;
>image.width = image.height = size : any
>image.width : number
>image : HTMLImageElement
>width : number
>image.height = size : any
>image.height : number
>image : HTMLImageElement
>height : number
>size : any
document.body.appendChild(image);
>document.body.appendChild(image) : HTMLImageElement
>document.body.appendChild : <T extends Node>(newChild: T) => T
>document.body : HTMLElement
>document : Document
>body : HTMLElement
>appendChild : <T extends Node>(newChild: T) => T
>image : HTMLImageElement
})();
=== tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts ===
export let x = import.meta;
>x : ImportMeta
>import.meta : ImportMeta
>meta : any
export let y = import.metal;
>y : any
>import.metal : any
>metal : any
export let z = import.import.import.malkovich;
>z : any
>import.import.import.malkovich : any
>import.import.import : any
>import.import : any
>import : any
>import : any
>malkovich : any
=== tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts ===
let globalA = import.meta;
>globalA : ImportMeta
>import.meta : ImportMeta
>meta : any
let globalB = import.metal;
>globalB : any
>import.metal : any
>metal : any
let globalC = import.import.import.malkovich;
>globalC : any
>import.import.import.malkovich : any
>import.import.import : any
>import.import : any
>import : any
>import : any
>malkovich : any
=== tests/cases/conformance/es2019/importMeta/assignmentTargets.ts ===
export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta;
>foo : ImportMeta
>ImportMeta : ImportMeta
>import.meta.blah = import.meta.blue = import.meta : ImportMeta
>import.meta.blah : any
>import.meta : ImportMeta
>meta : any
>blah : any
>import.meta.blue = import.meta : ImportMeta
>import.meta.blue : any
>import.meta : ImportMeta
>meta : any
>blue : any
>import.meta : ImportMeta
>meta : any
import.meta = foo;
>import.meta = foo : ImportMeta
>import.meta : ImportMeta
>meta : any
>foo : ImportMeta
// @Filename augmentations.ts
declare global {
>global : any
interface ImportMeta {
>ImportMeta : ImportMeta
wellKnownProperty: { a: number, b: string, c: boolean };
>wellKnownProperty : { a: number; b: string; c: boolean; }
>a : number
>b : string
>c : boolean
}
}
const { a, b, c } = import.meta.wellKnownProperty;
>a : number
>b : string
>c : boolean
>import.meta.wellKnownProperty : { a: number; b: string; c: boolean; }
>import.meta : ImportMeta
>meta : any
>wellKnownProperty : { a: number; b: string; c: boolean; }