diff --git a/.changeset/pretty-spiders-brush.md b/.changeset/pretty-spiders-brush.md new file mode 100644 index 00000000..3e78e398 --- /dev/null +++ b/.changeset/pretty-spiders-brush.md @@ -0,0 +1,8 @@ +--- +"@marko/language-server": patch +"@marko/language-tools": patch +"@marko/type-check": patch +"marko-vscode": patch +--- + +Revert change to renderBody codegen which caused a regression with the `` tag. diff --git a/packages/language-server/src/__tests__/fixtures/script/custom-tag-args/__snapshots__/custom-tag-args.expected/index.md b/packages/language-server/src/__tests__/fixtures/script/custom-tag-args/__snapshots__/custom-tag-args.expected/index.md index 2a3becde..6cd804c7 100644 --- a/packages/language-server/src/__tests__/fixtures/script/custom-tag-args/__snapshots__/custom-tag-args.expected/index.md +++ b/packages/language-server/src/__tests__/fixtures/script/custom-tag-args/__snapshots__/custom-tag-args.expected/index.md @@ -1,20 +1,11 @@ ## Diagnostics -### Ln 2, Col 11 +### Ln 3, Col 10 ```marko - 1 | -> 2 | - | ^^^^^^^^ Argument of type 'string' is not assignable to parameter of type 'Directives & Input'. - Type 'string' is not assignable to type 'Input'. - 3 | - 4 | -``` - -### Ln 3, Col 21 -```marko - 1 | - 2 | + 1 | + 2 | > 3 | - | ^^^^ Expected 1 arguments, but got 3. + | ^^^^^^^^^^^^^^^^ Type of computed property's value is '[string, number, number]', which is not assignable to type '[string, (number | undefined)?]'. + Source has 3 element(s) but target allows only 2. 4 | ``` diff --git a/packages/language-server/src/__tests__/fixtures/script/custom-tag-args/components/test-tag.marko b/packages/language-server/src/__tests__/fixtures/script/custom-tag-args/components/test-tag.marko index 24046b6a..90bc8c18 100644 --- a/packages/language-server/src/__tests__/fixtures/script/custom-tag-args/components/test-tag.marko +++ b/packages/language-server/src/__tests__/fixtures/script/custom-tag-args/components/test-tag.marko @@ -1,4 +1,4 @@ export interface Input { - value: string + value: [string, number?] }
diff --git a/packages/language-server/src/__tests__/fixtures/script/custom-tag-args/index.marko b/packages/language-server/src/__tests__/fixtures/script/custom-tag-args/index.marko index 9030b177..cd1e097f 100644 --- a/packages/language-server/src/__tests__/fixtures/script/custom-tag-args/index.marko +++ b/packages/language-server/src/__tests__/fixtures/script/custom-tag-args/index.marko @@ -1,3 +1,3 @@ - + diff --git a/packages/language-server/src/__tests__/fixtures/script/render-body-basic/components/my-tag/index.marko b/packages/language-server/src/__tests__/fixtures/script/render-body-basic/components/my-tag/index.marko index 38b5a925..e27336b2 100644 --- a/packages/language-server/src/__tests__/fixtures/script/render-body-basic/components/my-tag/index.marko +++ b/packages/language-server/src/__tests__/fixtures/script/render-body-basic/components/my-tag/index.marko @@ -2,4 +2,9 @@ export interface Input { renderBody: Marko.Body<[string]> } +<${input.renderBody} value=["hi"] /> + +<${input.renderBody}=["hi"] /> + <${input.renderBody}("hi") /> + diff --git a/packages/language-server/src/__tests__/fixtures/script/return-tag-nested/components/test-tag.marko b/packages/language-server/src/__tests__/fixtures/script/return-tag-nested/components/test-tag.marko index fc1bc6ae..5473a9ee 100644 --- a/packages/language-server/src/__tests__/fixtures/script/return-tag-nested/components/test-tag.marko +++ b/packages/language-server/src/__tests__/fixtures/script/return-tag-nested/components/test-tag.marko @@ -2,4 +2,4 @@ export interface Input { renderBody: Marko.Body<["a"], { value: "a" | "b" }> } -<${input.renderBody}("a") /> +<${input.renderBody}=["a"] /> diff --git a/packages/language-server/src/__tests__/fixtures/script/tag-params-basic/__snapshots__/tag-params-basic.expected/components/test-tag.md b/packages/language-server/src/__tests__/fixtures/script/tag-params-basic/__snapshots__/tag-params-basic.expected/components/test-tag.md index c50c1060..b34e96dd 100644 --- a/packages/language-server/src/__tests__/fixtures/script/tag-params-basic/__snapshots__/tag-params-basic.expected/components/test-tag.md +++ b/packages/language-server/src/__tests__/fixtures/script/tag-params-basic/__snapshots__/tag-params-basic.expected/components/test-tag.md @@ -1,21 +1,22 @@ ## Diagnostics -### Ln 7, Col 27 +### Ln 7, Col 28 ```marko - 5 | <${input.renderBody}("a", "b") /> + 5 | <${input.renderBody}=["a", "b"] /> 6 | -> 7 | <${input.renderBody}("a", "c") /> - | ^^^ Argument of type '"c"' is not assignable to parameter of type '"b"'. +> 7 | <${input.renderBody}=["a", "c"] /> + | ^^^ Type '"c"' is not assignable to type '"b"'. 8 | - 9 | <${input.renderBody}("a", "b", "c") /> + 9 | <${input.renderBody}=["a", "b", "c"] /> 10 | ``` -### Ln 9, Col 32 +### Ln 9, Col 21 ```marko - 7 | <${input.renderBody}("a", "c") /> + 7 | <${input.renderBody}=["a", "c"] /> 8 | -> 9 | <${input.renderBody}("a", "b", "c") /> - | ^^^ Expected 2 arguments, but got 3. +> 9 | <${input.renderBody}=["a", "b", "c"] /> + | ^ Type '["a", "b", string]' is not assignable to type '["a", "b"]'. + Source has 3 element(s) but target allows only 2. 10 | ``` diff --git a/packages/language-server/src/__tests__/fixtures/script/tag-params-basic/components/test-tag.marko b/packages/language-server/src/__tests__/fixtures/script/tag-params-basic/components/test-tag.marko index 4ac9cd34..fa73ae6f 100644 --- a/packages/language-server/src/__tests__/fixtures/script/tag-params-basic/components/test-tag.marko +++ b/packages/language-server/src/__tests__/fixtures/script/tag-params-basic/components/test-tag.marko @@ -2,8 +2,8 @@ export interface Input { renderBody: Marko.Body<["a", "b"]> } -<${input.renderBody}("a", "b") /> +<${input.renderBody}=["a", "b"] /> -<${input.renderBody}("a", "c") /> +<${input.renderBody}=["a", "c"] /> -<${input.renderBody}("a", "b", "c") /> +<${input.renderBody}=["a", "b", "c"] /> diff --git a/packages/language-tools/marko.internal.d.ts b/packages/language-tools/marko.internal.d.ts index 81661490..072c5c94 100644 --- a/packages/language-tools/marko.internal.d.ts +++ b/packages/language-tools/marko.internal.d.ts @@ -310,10 +310,14 @@ declare global { ? NativeTagRenderer : [Name] extends [AnyMarkoBody] ? BodyRenderer - : [Name] extends [ - { renderBody?: infer Name extends AnyMarkoBody }, - ] - ? BodyRenderer + : [Name] extends [{ renderBody?: AnyMarkoBody }] + ? [Name["renderBody"]] extends [AnyMarkoBody] + ? BodyRenderer + : BaseRenderer< + RenderBodyInput< + BodyParameters> + > + > : DefaultRenderer; export type TemplateRenderer