How to use TypeScript for a custom Node.js server. #13208
-
As we can see in this template, we're using JavaScript for the server.js code. It makes it hard for me to code because I want to implement Socket.IO, and I need TypeScript because it will make my job much easier. Are there any ways to achieve this? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I suggest a mix of 1 and 3 or 2 and 3. The third one will avoid a problem that may bite you later. It's described in the linked discussion. |
Beta Was this translation helpful? Give feedback.
-
In the template the actual file which gets fed into bundle pipeline is |
Beta Was this translation helpful? Give feedback.
ts-node
,tsx
, etc.entry.server.tsx
and import fromserver.js
as I suggest here.server.ts
file withtsc
before running.I suggest a mix of 1 and 3 or 2 and 3. The third one will avoid a problem that may bite you later. It's described in the linked discussion.