immerjs / immer

Create the next immutable state by mutating the current one

Home Page:https://immerjs.github.io/immer/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ESM module: "Could not find a declaration file for module 'typeorm'"

DemianD opened this issue Β· comments

πŸ› Bug Report

A minimal ESM module with only Immer does not compile.

Link to repro

This is a node issue, and I wasn't able to reproduce it using CodeSandbox. Therefore I created a repro case using a repository: https://github.com/DemianD/immer-repo-esm-issue

You can see that the build is failing at the GitHub Action: https://github.com/DemianD/immer-repo-esm-issue/runs/6829873617?check_suite_focus=true

To Reproduce

See the repro

Observed behavior

❯  npm run build

> build
> tsc

src/server.ts:1:25 - error TS7016: Could not find a declaration file for module 'immer'. '/Users/demian/github/immer-repo/node_modules/immer/dist/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/immer` if it exists or add a new declaration (.d.ts) file containing `declare module 'immer';`

1 import { produce } from 'immer'

Expected behavior

The project should compile without error.

Environment

We only accept bug reports against the latest Immer version.

  • Immer version: 9.0.14
  • I filed this report against the latest version of Immer
  • Occurs with setUseProxies(true)
  • Occurs with setUseProxies(false) (ES5 only)