Proposal: Add first-party core support for TypeScript configuration, data, and template files (👍23) #4007
Replies: 7 comments
-
|
Some good info here too: https://2ality.com/2025/01/nodejs-strip-type.html |
Beta Was this translation helpful? Give feedback.
-
Robust type signatures would be a huge boon for me — I was looking at Eleventy last week for a project that's outgrowing Zola but found the lack of type signatures very frustrating to use.I almost wrote a big issue/proposal for this just last week, but decided against it. I'm not finding many alternatives to eleventy that look very appealing, though, so here I am :) Robust type signatures would be a huge boon for me — I was working through pauleveritt/eleventy-tsx, but I found working with TSX for layouts really challenging. When I write a component like this: export function MainLayout(props: any): JSX.Element {
return (
<html lang="en">
<head>
<title>{props.title}</title>
</head>
<body>
<Heading name={props.title} />
{props.content}
</body>
</html>
);
}
export const render = MainLayout;The A good example is the I find reliable and rich type information really critical when I'm writing software, and was pretty sad that I couldn't leverage them here. I understand some of the data is dynamic, but some of it is guaranteed by Eleventy — I think TypeScript lets you express things like "there's a |
Beta Was this translation helpful? Give feedback.
-
|
Related: https://github.com/11ty/eleventy-dependency-tree-esm/issues/6 |
Beta Was this translation helpful? Give feedback.
-
|
@9999years you may find the definitions (somewhat out of date) but more importantly the mechanics in my site useful for expressing those kinds of props. Of particular interest to you on that front would be:
Now, because of how data merging and the cascade and the overall design of 11ty config works, you aren’t generally going to be able to provide guarantees that span the codebase with that—there are just a bunch of places where there isn’t a good way to connect the different contracts between e.g. the |
Beta Was this translation helpful? Give feedback.
-
|
What's necessary to help move this forward? |
Beta Was this translation helpful? Give feedback.
-
|
@panoply has done some nice work here and I have tried to contribute some too by extending it and working on the main module. |
Beta Was this translation helpful? Give feedback.
-
|
Moved this one back to two separate issues, both milestoned for 4.0: #4194 #4195 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In preparation for Node.js stable to ship TypeScript stripping as an unflagged feature https://nodejs.org/api/typescript.html
We already provide support for TypeScript via
tsx, documented here: https://www.11ty.dev/docs/languages/typescript/Default Configuration File Names
eleventy.config.tseleventy.config.mtseleventy.config.ctsDefault Data File Names
*.11tydata.ts*.11tydata.mts*.11tydata.ctsDefault TypeScript Template File Names
*.11ty.ts*.11ty.mts*.11ty.ctsDependency Tree Mapping
See https://github.com/11ty/eleventy-dependency-tree-esm and https://github.com/11ty/eleventy-dependency-tree for existing solutions.
Beta Was this translation helpful? Give feedback.
All reactions