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

Unexpected type errors #355

Open
adamzerner opened this issue Dec 17, 2023 · 0 comments
Open

Unexpected type errors #355

adamzerner opened this issue Dec 17, 2023 · 0 comments

Comments

@adamzerner
Copy link

adamzerner commented Dec 17, 2023

I am working on RFUI which is a component library intended to be available to React and Preact projects. Right now I'm using Preact, but eventually I want to figure out how to get it working for React as well.

Anyway, right now I want to publish to NPM. I followed the instructions in the "Setup" section, but I get a bunch of type errors. I've got this build-npm.ts script. When I run it, I get the following output (full output: output.txt):

code/rfui [master●] » deno run -A scripts/build-npm.ts 0.0.12
[dnt] Transforming...
[dnt] Running npm install...

added 3 packages, and audited 4 packages in 293ms

found 0 vulnerabilities
[dnt] Building project...
[dnt] Type checking ESM...
src/components/atoms/badge.tsx:1:37 - error TS2307: Cannot find module 'preact' or its corresponding type declarations.

1 import { ComponentChild, JSX } from "preact";
                                      ~~~~~~~~
src/components/atoms/badge.tsx:8:29 - error TS2304: Cannot find name 'HTMLDivElement'.

8 } & Omit<JSX.HTMLAttributes<HTMLDivElement>, "size">;
                              ~~~~~~~~~~~~~~
src/components/atoms/badge.tsx:8:29 - error TS4081: Exported type alias 'BadgeType' has or is using private name 'HTMLDivElement'.

8 } & Omit<JSX.HTMLAttributes<HTMLDivElement>, "size">;
                              ~~~~~~~~~~~~~~
src/components/atoms/badge.tsx:72:5 - error TS7026: JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists.

72     <div
       ~~~~
73       {...restWithoutClass}
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~
74       class={className}
   ~~~~~~~~~~~~~~~~~~~~~~~
75     >
   ~~~~~
src/components/atoms/badge.tsx:72:6 - error TS2304: Cannot find name 'React'.

72     <div
        ~~~
src/components/atoms/badge.tsx:77:5 - error TS7026: JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists.

I don't understand why this is. I am inside of a Fresh project. In that project, everything works fine. No type errors.

I'm also not clear on whether this matters or not. I see that you can ignore these type errors (amongst other stuff) if you want, but I don't understand what the implications are of doing so, and whether or not doing so would be wise.

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