swc/crates/swc_ecma_parser/tests/tsc/jsDeclarationsComputedNames.ts

33 lines
620 B
TypeScript

// @allowJs: true
// @checkJs: true
// @target: es5
// @lib: es6
// @outDir: ./out
// @declaration: true
// @filename: index.js
const TopLevelSym = Symbol();
const InnerSym = Symbol();
module.exports = {
[TopLevelSym](x = 12) {
return x;
},
items: {
[InnerSym]: (arg = {x: 12}) => arg.x
}
}
// @filename: index2.js
const TopLevelSym = Symbol();
const InnerSym = Symbol();
export class MyClass {
static [TopLevelSym] = 12;
[InnerSym] = "ok";
/**
* @param {typeof TopLevelSym | typeof InnerSym} _p
*/
constructor(_p = InnerSym) {
// switch on _p
}
}