mirror of
https://github.com/oxc-project/oxc.git
synced 2026-11-04 10:29:58 +00:00
feat(parser): add TS1048 code to diagnostic (#18546)
https://github.com/microsoft/typescript/blob/7affa9e5403035b6d281616e6651529e7387f253/src/compiler/diagnosticMessages.json#L142-L145
This commit is contained in:
1 parent
34c3ec30d3
commit
866b6b3edd
4 files changed
+318
-318
No files matched your search
@@ -794,7 +794,7 @@ pub fn rest_element_property_name(span: Span) -> OxcDiagnostic {
|
||||
|
||||
#[cold]
|
||||
pub fn a_rest_element_cannot_have_an_initializer(span: Span) -> OxcDiagnostic {
|
||||
OxcDiagnostic::error("A rest element cannot have an initializer.").with_label(span)
|
||||
ts_error("1048", "A rest element cannot have an initializer.").with_label(span)
|
||||
}
|
||||
|
||||
#[cold]
|
||||
|
||||
@@ -4148,7 +4148,7 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc
|
||||
· ────
|
||||
╰────
|
||||
|
||||
× A rest element cannot have an initializer.
|
||||
× TS(1048): A rest element cannot have an initializer.
|
||||
╭─[babel/packages/babel-parser/test/fixtures/es2015/uncategorised/278/input.js:1:18]
|
||||
1 │ function f(a, ...b = 0)
|
||||
· ─────
|
||||
@@ -5663,7 +5663,7 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc
|
||||
· ─────
|
||||
╰────
|
||||
|
||||
× A rest element cannot have an initializer.
|
||||
× TS(1048): A rest element cannot have an initializer.
|
||||
╭─[babel/packages/babel-parser/test/fixtures/es2018/object-rest-spread/22/input.js:1:9]
|
||||
1 │ var {...x = 1} = {}
|
||||
· ─────
|
||||
@@ -5676,7 +5676,7 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc
|
||||
╰────
|
||||
help: Expected identifier in rest element
|
||||
|
||||
× A rest element cannot have an initializer.
|
||||
× TS(1048): A rest element cannot have an initializer.
|
||||
╭─[babel/packages/babel-parser/test/fixtures/es2018/object-rest-spread/23/input.js:1:19]
|
||||
1 │ function test({...x = 1}) {}
|
||||
· ─────
|
||||
@@ -11877,7 +11877,7 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc
|
||||
· ────
|
||||
╰────
|
||||
|
||||
× A rest element cannot have an initializer.
|
||||
× TS(1048): A rest element cannot have an initializer.
|
||||
╭─[babel/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0260/input.js:1:15]
|
||||
1 │ function x(...a = 1){}
|
||||
· ─────
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -10144,7 +10144,7 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/statements/Va
|
||||
╰────
|
||||
help: Remove this `?`. The default value is an empty array
|
||||
|
||||
× A rest element cannot have an initializer.
|
||||
× TS(1048): A rest element cannot have an initializer.
|
||||
╭─[typescript/tests/cases/compiler/restParamAsOptional.ts:2:16]
|
||||
1 │ function f(...x?) { }
|
||||
2 │ function f2(...x = []) { }
|
||||
@@ -10175,7 +10175,7 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/statements/Va
|
||||
· ────
|
||||
╰────
|
||||
|
||||
× A rest element cannot have an initializer.
|
||||
× TS(1048): A rest element cannot have an initializer.
|
||||
╭─[typescript/tests/cases/compiler/restParameterWithBindingPattern3.ts:3:19]
|
||||
2 │
|
||||
3 │ function b(...[...foo = []]: string[]) { }
|
||||
@@ -16142,7 +16142,7 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/statements/Va
|
||||
╰────
|
||||
help: Remove this `?`. The default value is an empty array
|
||||
|
||||
× A rest element cannot have an initializer.
|
||||
× TS(1048): A rest element cannot have an initializer.
|
||||
╭─[typescript/tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts:15:16]
|
||||
14 │ function a3(...b?) { } // Error, can't be optional
|
||||
15 │ function a4(...b = [1,2,3]) { } // Error, can't have initializer
|
||||
@@ -16490,7 +16490,7 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/statements/Va
|
||||
· ─────
|
||||
╰────
|
||||
|
||||
× A rest element cannot have an initializer.
|
||||
× TS(1048): A rest element cannot have an initializer.
|
||||
╭─[typescript/tests/cases/conformance/es6/destructuring/restElementWithInitializer1.ts:2:9]
|
||||
1 │ declare var a: number[];
|
||||
2 │ var [...x = a] = a; // Error, rest element cannot have initializer
|
||||
@@ -22715,7 +22715,7 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/statements/Va
|
||||
3 │ }
|
||||
╰────
|
||||
|
||||
× A rest element cannot have an initializer.
|
||||
× TS(1048): A rest element cannot have an initializer.
|
||||
╭─[typescript/tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList10.ts:2:11]
|
||||
1 │ class C {
|
||||
2 │ foo(...bar = 0) { }
|
||||
|
||||
Reference in new issue
Block a user