1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
//// [mappedTypeProperties.ts]
export type PlaceType = 'openSky' | 'roofed' | 'garage'
type Before = {
model: 'hour' | 'day';
[placeType in PlaceType]: void;
}
type After = {
[placeType in PlaceType]: void;
model: 'hour' | 'day'
}
type AfterQuestion = {
[placeType in PlaceType]?: void;
model: 'hour' | 'day';
}
type AfterMethod = {
[placeType in PlaceType]?: void;
model(duration: number): 'hour' | 'day';
}
type AfterImplicit = {
[placeType in PlaceType]
model: 'hour' | 'day';
}
type AfterImplicitQ = {
[placeType in PlaceType]?
model: 'hour' | 'day'
}
interface I {
[P in PlaceType]: any
}
class C {
[P in PlaceType]: any
}
const D = class {
[P in PlaceType]: any
}
const E = class {
[P in 'a' | 'b']: any
}
//// [mappedTypeProperties.js]
"use strict";
var _a, _b;
exports.__esModule = true;
var C = /** @class */ (function () {
function C() {
}
return C;
}());
P in PlaceType;
var D = (_a = /** @class */ (function () {
function class_1() {
}
return class_1;
}()),
P in PlaceType,
_a);
var E = (_b = /** @class */ (function () {
function class_2() {
}
return class_2;
}()),
P in 'a' | 'b',
_b);
//// [mappedTypeProperties.d.ts]
export type PlaceType = 'openSky' | 'roofed' | 'garage';
|