Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing a custom tsconfig. #719

Open
talentlessguy opened this issue Oct 12, 2023 · 2 comments
Open

Allow passing a custom tsconfig. #719

talentlessguy opened this issue Oct 12, 2023 · 2 comments

Comments

@talentlessguy
Copy link

talentlessguy commented Oct 12, 2023

Hi,

I have a case where I want to use Pastel together with a GraphQL client that I have.

But right now it fails it to properly import (types are not resolved) because the generated index.d.ts imports from './schema' instead of './schema.js':

import {
  FieldsSelection,
  GraphqlOperation,
  ClientOptions,
  ClientRequestConfig,
  Observable,
} from '@gqlts/runtime'
import { Client as WSClient } from 'graphql-ws'
import { AxiosInstance } from 'axios'
export * from './schema' // should be `schema.js`

Would be nice to either respect the current tsconfig file or to be able to pass it in the library like this:

import { generate } from '@gqlts/cli'
import { printSchema } from 'graphql'
import { schema } from '@stauro/api'
import path from 'node:path'
import { fileURLToPath } from 'node:url'

const tsConfig = JSON.parse(await fs.readFile('./tsconfig.json', 'utf-8'))

await generate({
  schema: printSchema(schema),
  onlyEsModules: true,
  output: path.join(fileURLToPath(new URL('.', import.meta.url)), 'generated'),
  tsconfig,
})

my tsconfig:

{
  "compilerOptions": {
    "jsx": "react",
    "preserveSymlinks": true,
    "moduleResolution": "Node16",
    "module": "Node16"
  }
}
@meabed
Copy link
Owner

meabed commented Oct 12, 2023

Thanks @talentlessguy sounds good, I will check this approach and add it

@talentlessguy
Copy link
Author

awesome, thank you for a quick response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants