This repository has been archived by the owner on Apr 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 787
Release 2.2 depends on SyntheticDefaultImports for ts definitions #2433
Comments
Caused by #2045 |
hwillson
added a commit
that referenced
this issue
Sep 29, 2018
Typescript's `allowSyntheticDefaultImports` compiler option is something we'd like to start using, but I jumped the gun a bit by introducing it in 9a96519. Including it means that anyone who wants to use Typescript with React Apollo would have to also include it in their own local `tsconfig.json`, to be able to handle default imports properly. This is because we're also using Typescript's `es2015` module option, which means `allowSyntheticDefaultImports` has to be enabled explicitly. This commit removes `allowSyntheticDefaultImports` use, switching back to using a combination of `import * as X` and `require` syntax, to work with default imports. We'll re-introduce `allowSyntheticDefaultImports` use in React Apollo 3. Fixes #2433.
hwillson
added a commit
that referenced
this issue
Sep 29, 2018
Typescript's `allowSyntheticDefaultImports` compiler option is something we'd like to start using, but I jumped the gun a bit by introducing it in 9a96519. Including it means that anyone who wants to use Typescript with React Apollo would have to also include it in their own local `tsconfig.json`, to be able to handle default imports properly. This is because we're also using Typescript's `es2015` module option, which means `allowSyntheticDefaultImports` has to be enabled explicitly. This commit removes `allowSyntheticDefaultImports` use, switching back to using a combination of `import * as X` and `require` syntax, to work with default imports. We'll re-introduce `allowSyntheticDefaultImports` use in React Apollo 3. Fixes #2433.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Intended outcome:
The published library should not depend on any additional configuration. The types of the wrapped components need to be inferred correctly.
Actual outcome:
The published release has the following typings throughout the project i. e. in graphql.d.ts
import React from 'react';
This only works, if the tsconfig.json has the following compiler options defined.
"allowSyntheticDefaultImports": true
The typings in previous released defined it as
import * as React from 'react'
The wrapped components are typed as any.
How to reproduce the issue:
Set allowSyntheticDefaultImports: false.
Try to use graphql HOC. The types are any, although stronlgy typed.
With the allowSyntheticDefaultImports the types are inferred.
Version
The text was updated successfully, but these errors were encountered: