From ea94d732ef11f23135d75a3446d7ab0f01f5412d Mon Sep 17 00:00:00 2001 From: Sikan He Date: Tue, 5 Dec 2023 10:53:26 -0800 Subject: [PATCH] try .ts extension --- src/build.ts | 2 +- src/define.ts | 2 +- src/index.ts | 6 +++--- src/relay.ts | 4 ++-- test-api/api.ts | 4 ++-- tsconfig.json | 5 +++-- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/build.ts b/src/build.ts index 51f2133..dbbd00a 100644 --- a/src/build.ts +++ b/src/build.ts @@ -11,7 +11,7 @@ import type { GqlContext, UnionType, InterfaceType, -} from './types.js'; +} from './types.ts'; export function buildGraphQLSchema( schema: Schema diff --git a/src/define.ts b/src/define.ts index a07ef26..844696a 100644 --- a/src/define.ts +++ b/src/define.ts @@ -20,7 +20,7 @@ import type { SubscriptionObjectType, PromiseOrValue, GqlContext, -} from './types.js'; +} from './types.ts'; type ExtensionsMap = { field?: { diff --git a/src/index.ts b/src/index.ts index ec621d9..d65c584 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,7 @@ -export type * from './types.js'; -export { Gql } from './define.js'; +export type * from './types.ts'; +export { Gql } from './define.ts'; export { buildGraphQLSchema, toGraphQLInputType, toGraphQLOutputType, -} from './build.js'; +} from './build.ts'; diff --git a/src/relay.ts b/src/relay.ts index c84bc4e..52e9b16 100644 --- a/src/relay.ts +++ b/src/relay.ts @@ -5,8 +5,8 @@ import type { TOfArgMap, GqlContext, ObjectType, -} from './types.js'; -import { Gql } from './define.js'; +} from './types.ts'; +import { Gql } from './define.ts'; import { GraphQLResolveInfo } from 'graphql'; // Adapted from diff --git a/test-api/api.ts b/test-api/api.ts index 4a7586e..e9e83b6 100644 --- a/test-api/api.ts +++ b/test-api/api.ts @@ -1,6 +1,6 @@ -import { Gql, ObjectType } from '../src'; +import { Gql, ObjectType } from '../src/index.ts'; -declare module '../src/types' { +declare module '../src/types.ts' { interface Context { contextContent: string; } diff --git a/tsconfig.json b/tsconfig.json index 9513569..1f6ce39 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "target": "ES2019", "module": "ESNext", - "moduleResolution": "node", + "moduleResolution": "NodeNext", "rootDir": "src", "outDir": "dist", "declaration": true, @@ -13,7 +13,8 @@ "noUnusedParameters": true, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, - "skipLibCheck": true + "skipLibCheck": true, + "allowImportingTsExtensions": true, }, "files": ["./src/index.ts", "./src/relay.ts"] }