Fix a test for computed string key in enum (#18322)
This commit is contained in:
1 parent
e2ed914e02
commit
bbdec54a41
2 files changed
+12
-16
No files matched your search
@@ -12,7 +12,7 @@ Cause: Unexpected token (2:2)"
|
||||
exports[`snippet: #0 [babel-ts] format 2`] = `
|
||||
"Unexpected token (2:3)
|
||||
1 | enum Foo {
|
||||
> 2 | [foo] = 1
|
||||
> 2 | ['foo'] = 1
|
||||
| ^
|
||||
3 | }
|
||||
Cause: Unexpected token (2:2)"
|
||||
@@ -26,14 +26,6 @@ exports[`snippet: #0 [oxc-ts] format 1`] = `
|
||||
3 | }"
|
||||
`;
|
||||
|
||||
exports[`snippet: #0 [oxc-ts] format 2`] = `
|
||||
"Computed property names are not allowed in enums. (2:4)
|
||||
1 | enum Foo {
|
||||
> 2 | [foo] = 1
|
||||
| ^^^
|
||||
3 | }"
|
||||
`;
|
||||
|
||||
exports[`snippet: #0 [typescript] format 1`] = `
|
||||
"An enum member cannot have a numeric name. (2:3)
|
||||
1 | enum Foo {
|
||||
@@ -46,8 +38,8 @@ Cause: An enum member cannot have a numeric name."
|
||||
exports[`snippet: #0 [typescript] format 2`] = `
|
||||
"Computed property names are not allowed in enums. (2:3)
|
||||
1 | enum Foo {
|
||||
> 2 | [foo] = 1
|
||||
| ^^^^^
|
||||
> 2 | ['foo'] = 1
|
||||
| ^^^^^^^
|
||||
3 | }
|
||||
Cause: Computed property names are not allowed in enums."
|
||||
`;
|
||||
|
||||
@@ -14,13 +14,10 @@ runFormatTest(
|
||||
["typescript", "babel-ts", "oxc-ts"],
|
||||
);
|
||||
|
||||
// `oxc-ts` not rejecting
|
||||
// https://github.com/microsoft/TypeScript/issues/61834
|
||||
// https://github.com/microsoft/TypeScript/issues/42468
|
||||
runFormatTest(
|
||||
{
|
||||
importMeta: import.meta,
|
||||
snippets: ["[foo]"].map(
|
||||
snippets: ["['foo']"].map(
|
||||
(key) => outdent`
|
||||
enum Foo {
|
||||
${key} = 1
|
||||
@@ -28,5 +25,12 @@ runFormatTest(
|
||||
`,
|
||||
),
|
||||
},
|
||||
["typescript", "babel-ts", "oxc-ts"],
|
||||
[
|
||||
"typescript",
|
||||
"babel-ts",
|
||||
// `oxc-ts` not rejecting
|
||||
// https://github.com/microsoft/TypeScript/issues/61834
|
||||
// https://github.com/microsoft/TypeScript/issues/42468
|
||||
// "oxc-ts",
|
||||
],
|
||||
);
|
||||
Reference in new issue
Block a user