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

Usage with declared preact/compat type #105

Open
mu-hun opened this issue May 4, 2020 · 0 comments
Open

Usage with declared preact/compat type #105

mu-hun opened this issue May 4, 2020 · 0 comments

Comments

@mu-hun
Copy link

mu-hun commented May 4, 2020

Hello, There is a type conflict with the preact/compat type.

tsconfig.json

"paths": {
      "react": ["node_modules/preact/compat"],
      "react-dom": ["node_modules/preact/compat"],
      "linaria/react": ["src/utils/styled.ts"]
}

I alias react and react-dom type to preact/compat for use linaria/react(CSS in JS module) in typescript project.

type check result

❯ yarn tsc
yarn run v1.19.1
warning ../../../package.json: No license field
$ /Users/muhun/github/reflation/extension/node_modules/.bin/tsc
node_modules/@types/enzyme/index.d.ts:22:5 - error TS2724: preact/compat has no exported member 'ReactElement'. Did you mean 'createElement'?

22     ReactElement,
       ~~~~~~~~~~~~

node_modules/@types/enzyme/index.d.ts:30:14 - error TS2515: Non-abstract class 'ElementClass' does not implement inherited abstract member 'render' from class 'Component<any, any>'.

30 export class ElementClass extends Component<any, any> {}

The error in above not appear when remove preact/compat type alias. but another type error appear in react library. How can I solve it?

mu-hun added a commit to reflation/extension that referenced this issue May 4, 2020
I fail to use enzyme with declared preact/compat type:
preactjs/enzyme-adapter-preact-pure#105
mu-hun added a commit to reflation/extension that referenced this issue May 5, 2020
I fail to use enzyme with declared preact/compat type:
preactjs/enzyme-adapter-preact-pure#105
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

1 participant