million icon indicating copy to clipboard operation
million copied to clipboard

bug: There's no type declarations for the path "million/preact"

Open Nyaacinth opened this issue 1 year ago • 8 comments

Describe the bug There's no type declarations for the path "million/preact", there's only "react.d.ts" for "million/react" at the root of package "million", and according to the doc, we need to import from "million/preact" to use it with preact. But it will just work as intended if you ignore the type error.

To Reproduce Steps to reproduce the behavior:

  1. Run command pnpm add million in your project folder
  2. Create a file and try to import { block } from "million/preact"
  3. See the ts-error

Expected behavior Able to import with no error

Screenshots screenshot.png

Device (please complete the following information):

  • Your Computer?

Additional context Nope

Nyaacinth avatar Jun 18 '23 09:06 Nyaacinth

Yo @aidenybai, can you check this out?

tobySolutions avatar Jun 18 '23 09:06 tobySolutions

Hello @Nyaacinth, did you set up your compiler in Preact?

In the documentation, we have the steps follow when setting up Million in Preact

https://million.dev/docs/install can help you out.

tobySolutions avatar Jun 18 '23 09:06 tobySolutions

Hello @Nyaacinth, did you set up your compiler in Preact?

In the documentation, we have the steps follow when setting up Million in Preact

https://million.dev/docs/install can help you out.

Yes, set vite with million.vite({ mode: "preact" }), i think the problem is not about the compiler, because the code can run with correct behavior, there're only type errors

Nyaacinth avatar Jun 18 '23 09:06 Nyaacinth

Hello @Nyaacinth, did you set up your compiler in Preact?

In the documentation, we have the steps follow when setting up Million in Preact

https://million.dev/docs/install can help you out.

Yes, set vite with million.vite({ mode: "preact" }), i think the problem is not about the compiler, because the code can run with correct behavior, there're only type errors

Hmmm, thank you. Let me raise this up with the team and we can have a look. 👀👀

tobySolutions avatar Jun 18 '23 10:06 tobySolutions

@tobySolutions @Nyaacinth Is this a bug that only happens with pnpm?

Yes, set vite with million.vite({ mode: "preact" }), i think the problem is not about the compiler, because the code can run with correct behavior, there're only type errors

If I restart VSCode after adding it, won't the error stop happening?

nojiritakeshi avatar Jun 18 '23 14:06 nojiritakeshi

Is this a bug that only happens with pnpm?

No, you can install the package with any valid node package manager, but the problem will continue to happen. You can check this.

If I restart VSCode after adding it, won't the error stop happening?

No, to avoid IDE-only errors, I always rerun tsc for checking,


Overall, it might be only a re-export missing, since there's only export * from './dist/react'; in the "react.d.ts". I think the only thing we need is just a re-export * from './dist/preact'; in the "preact.d.ts" at the root of the package

Actually, you can import from "million/dist/preact", and tsc won't complain about it. But there might be some other bugs if you do this.

Nyaacinth avatar Jun 18 '23 22:06 Nyaacinth

Confirmed with v2.4.6, the bug still exists

Nyaacinth avatar Jun 19 '23 12:06 Nyaacinth

Confirmed with v2.4.6, the bug still exists

It still exists?? 🤔🤔

tobySolutions avatar Jun 19 '23 18:06 tobySolutions

As it got fixed in the latest release, I'll close this issue. Thank you all for developing this amazing lib!

Nyaacinth avatar Jun 25 '23 09:06 Nyaacinth