Skip to content

Commit

Permalink
fix: use .d.marko for await tag types
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanPiercey committed Jul 18, 2023
1 parent 02cea4f commit 7957fb5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
6 changes: 6 additions & 0 deletions .changeset/clean-lemons-collect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@marko/translator-default": patch
"marko": patch
---

Switch to .d.marko file for <await> tag types to avoid issues when loaded in a pure typescript project. By default TypeScript doesn't play well with `node_modules` which are seen as `.js` files which is what the jsdoc version of a Marko file appears as. By switching to a `.d.marko` it is instead always seen as `.ts` which is always analyzed by typescript.
10 changes: 10 additions & 0 deletions packages/marko/src/core-tags/core/await/index.d.marko
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export interface Input<T> {
value: readonly [T];
then?: { renderBody: Marko.Body<[Awaited<T>]> };
catch?: { renderBody: Marko.Body<[unknown]> };
placeholder?: { renderBody: Marko.Body };
"client-reorder"?: boolean;
name?: string;
timeout?: number;
"show-after"?: string;
}
13 changes: 0 additions & 13 deletions packages/marko/src/core-tags/core/await/index.marko

This file was deleted.

2 changes: 1 addition & 1 deletion packages/translator-default/src/taglib/core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ export default {
},
"<await>": {
renderer: "marko/src/core-tags/core/await/renderer.js",
types: "marko/src/core-tags/core/await/index.marko",
types: "marko/src/core-tags/core/await/index.d.marko",
"code-generator": translateAwait,
"@_provider": "expression",
"@_name": "string",
Expand Down

0 comments on commit 7957fb5

Please sign in to comment.