Need help with typescript
import { Hono } from 'hono'
import githubApp from './routes/github'
const app = new Hono()
const welcomeStrings = [
'Hello Hono!',
'To learn more about Hono on Vercel, visit https://vercel.com/docs/frameworks/hono'
]
app.get('/', (c) => {
return c.text(welcomeStrings.join('\n\n'))
})
export default app
I have this basic index.ts
but i cant import the github.ts like that my code editor tells me to use .js
but that doenst look right6 Replies
{
"compilerOptions": {
"target": "ESNext",
"module": "NodeNext",
"strict": true,
"skipLibCheck": true,
"types": ["node"],
"jsx": "react-jsx",
"jsxImportSource": "hono/jsx",
"outDir": "./dist",
"paths": {
"@/*": [
"./src/*"
]
}
},
"exclude": ["node_modules"]
}
This is a typescript/nodejs thing, not a hono thing, but you're looking for the allowImportingTsExtensions key in
tsconfig.json
You'll need something that can process typescript files though, ie you're using ts-node or some equivalent, or some other runtime that supports it (workerd, bun)nodejs can process typescript files!
it doesn't do type checking and merely strips the types
so stuff like enums won't work

Isn't it still experimental (and require a flag)?
it doesn't require a flag on v24
https://nodejs.org/docs/latest-v24.x/api/typescript.html#typescript-features
it is a release candidate
Release candidate. Experimental features at this stage are hopefully ready to become stable. No further breaking changes are anticipated but may still occur in response to user feedback or the features' underlying specification development. We encourage user testing and feedback so that we can know that this feature is ready to be marked as stable.since it doesn't do transformations and only supports stripping types, I wouldn't worry about it not working one thing that doesn't work is typescript path aliases, since it'd require to either transform the import or to depend on the tsconfig