Skip to content

Bug: React not defined in TypeScript when importing from npm #28822

Closed as not planned
@nestarz

Description

@nestarz

React version: all

Steps To Reproduce

  1. Import React from "npm:react" inside Deno
  2. Observe that React is not defined in TypeScript

Code example:

import * as React from "npm:react";
// here React is not defined in typescript, we need to add @types/react
/* @deno-types="@types/react" */
import * as React from "npm:react";

The current behavior

React is not defined in TypeScript when importing it from "npm:react".

The expected behavior

React (and react-dom) should ship with types, at least in a .d.mts form, so that users don't have to bother adding types manually. As TypeScript is now widely used, React should provide first-class TypeScript support.

Related issue: denoland/deno#18203 but the solution we have doesn't address the issue directly. Maybe React should ship types and not the @DefinitelyTyped org.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution: StaleAutomatically closed due to inactivity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions