Skip to content

Commit 1dcf1dd

Browse files
committed
feat: content-type
1 parent 7cc539c commit 1dcf1dd

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

.changeset/tender-cases-remain.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"elysia-remote-dts": patch
3+
---
4+
5+
return content-type as typescript

src/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,10 @@ export const dts = (filePath: string, options?: Options) => {
99
.onStart(async () => {
1010
dts = await generateDts(filePath, options)
1111
})
12-
.get('/server.d.ts', () => dts)
12+
.get('/server.d.ts', ({ set }) => {
13+
// use same Content-Type as Deno
14+
// https://github.com/denoland/deno/blob/f42cb0816ef3be41213c0b2151b1d1c28495d4ce/cli/lsp/documents.rs#L1712
15+
set.headers['Content-Type'] = 'application/typescript'
16+
return dts
17+
})
1318
}

0 commit comments

Comments
 (0)