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

How to add types for React properly and mark React as peer dependency? #402

Open
krutoo opened this issue Apr 24, 2024 · 0 comments
Open

Comments

@krutoo
Copy link

krutoo commented Apr 24, 2024

Hi, im trying to build npm package with dnt

Source code of this package contains imports from react

Path react refers to npm:react@18 in deno.json#imports

When I add this comment before react import:

// @deno-types="npm:@types/react"

I have error during build:

src/react/use-bounding-client-rect.ts:2:63 - error TS6137: Cannot import type declaration files. Consider importing 'react' instead of '@types/react'.

2 import { type DependencyList, type RefObject, useState } from '@types/react';

How can i properly add react to this project with TS typings and mark it as peer dependency in dnt output?

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