You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: app/cookbook/use-typescript.md
+5-11
Original file line number
Diff line number
Diff line change
@@ -1,26 +1,20 @@
1
1
---
2
-
title: TypeScript template
2
+
title: Use TypeScript
3
3
---
4
4
5
-
We know you like [TypeScript](https://www.typescriptlang.org/). We’ve seen how often you search for TypeScript on the [Enhance](https://enhance.dev) documentation site. We’ve heard from users on our [Discord](https://enhance.dev/discord) that they want a way to work with TypeScript in their Enhance projects.
6
-
7
-
The thing is, you’ve always been able to use TypeScript with Enhance. The reason we haven’t officially described a way to set up an Enhance project with TypeScript before is because TypeScript configurations are a matter of taste and we didn’t want to give folks the impression that this is the only way.
8
-
9
-
However, this has given a number of folks the impression that you cannot use TypeScript with Enhance and we wanted to dispel that myth. According to one user we were giving serious “not a real project” vibes by not supporting TypeScript.
10
-
11
-
So today, we are introducing the [Enhance TypeScript Starter](https://github.com/enhance-dev/enhance-starter-typescript).
5
+
If you prefer to work with TypeScript, we recommend starting with our [TypeScript starter project](https://github.com/enhance-dev/enhance-starter-typescript).
12
6
13
7
14
8
## Getting Started
15
9
16
-
Assuming you are starting a new Enhance project you would run the command:
10
+
Assuming you’re starting a new Enhance project, you would run the command:
This will set up a new Enhance project where you will code your APIs, elements and pages in TypeScript instead of JavaScript. Instead of editing files in the `app` folder you will do your editing in the `ts` folder.
17
+
This will set up a new Enhance project where you’ll code your APIs, elements and pages in TypeScript instead of JavaScript. Instead of editing files in the `app` folder, you’ll do your editing in the `ts` folder.
24
18
25
19
26
20
### Project Structure
@@ -45,7 +39,7 @@ Note: We are using `.mts` to tell the TypeScript Compiler to generate ES Modules
45
39
46
40
## Local Development
47
41
48
-
Running the local development environment is the same as any other Enhance project. The new `@enhance/plugin-typescript` is responsible for watching the `ts` folder for any file changes. If the file has an `.mts` extension they are re-compiled with the compilation target being the `app` folder. All other file types are simply copied to their corresponding locations in the `app` folder.
42
+
Running the local development environment is the same as any other Enhance project. The new `@enhance/plugin-typescript` is responsible for watching the `ts` folder for any file changes. If a file with an `.mts` extension is updated, it will be re-compiled with the compilation target being the `app` folder. All other file types are simply copied to their corresponding locations in the `app` folder.
0 commit comments