需要帮助设置一个简单的TypeScript Preact应用。

huangapple go评论64阅读模式
英文:

need help setting a simple typescript preact app

问题

我是新手preact,我尝试在preact中使用typescript设置一个简单的应用。他们的默认和typescript模板包含不必要的东西,如jest和testing,我不需要。他们有另一个名为"simple"的模板,但只有js版本。

有没有办法在preact的"simple"模板中添加typescript?

我的目标是获得类似于preact的"simple"模板,但具有typescript和scss。

英文:

I am new to preact and I am trying to a setup a simple app with typescript in preact. Their default and typescript templates contain unnecessary things like jest and testing which I don't need. They have another template called "simple" but that only comes in js.

Is there any way to add typescript to the simple template of preact?

My goal is to get a template similar to the preact "simple" template with typescript and scss.

答案1

得分: 1

Full disclosure, I'm a maintainer of Preact-CLI and those templates.

You can simply switch .js files to .ts in the simple template and have TypeScript support, nothing else is needed. However, I'd caution against that route as the simple template is missing key fundamentals like file system-based code splitting, routing, some direction on how to handle assets, etc.

I'd recommend instead to simply remove the things from the TS template that you don't want. Remove jest (and associated packages) from the package.json if you don't want them.

英文:

Full disclosure, I'm a maintainer of Preact-CLI and those templates.

You can simply switch .js files to .ts in the simple template and have TypeScript support, nothing else is needed. However, I'd caution against that route as the simple template is missing key fundamentals like file system-based code splitting, routing, some direction on how to handle assets, etc.

I'd recommend instead to simply remove the things from the TS template that you don't want. Remove jest (and associated packages) from the package.json if you don't want them.

huangapple
  • 本文由 发表于 2023年3月12日 17:00:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/75712033.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定