Skip to content

Commit 4d2d665

Browse files
committed
🔧 fix: type error
1 parent 6726465 commit 4d2d665

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/gen/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ export const fromTypes =
174174
* Path to file where Elysia instance is
175175
*
176176
* The path must export an Elysia instance
177+
* or a literal TypeScript declaration
177178
*/
178179
targetFilePath = 'src/index.ts',
179180
{
@@ -188,8 +189,11 @@ export const fromTypes =
188189
}: OpenAPIGeneratorOptions = {}
189190
) =>
190191
() => {
191-
// targetFilePath is an actual dts reference
192-
if (targetFilePath.trim().startsWith('{'))
192+
// targetFilePath is an actual TypeScript declaration
193+
if (
194+
targetFilePath.trimStart().startsWith('{') &&
195+
targetFilePath.trimEnd().endsWith('}')
196+
)
193197
return declarationToJSONSchema(targetFilePath)
194198

195199
if (

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ function isCloudflareWorker() {
1313
try {
1414
// Check for the presence of caches.default, which is a global in Workers
1515
if (
16+
// @ts-ignore
1617
typeof caches !== 'undefined' &&
1718
// @ts-ignore
1819
typeof caches.default !== 'undefined'

0 commit comments

Comments
 (0)