pmndrs / valtio

💊 Valtio makes proxy-state simple for React and Vanilla
http://valtio.pmnd.rs
MIT License
8.7k stars 244 forks source link

tsc fails when using functions in valitio/utils #776

Closed fukumasuya closed 11 months ago

fukumasuya commented 11 months ago

Summary

I got the following tsc error when using functions in valtio/utils.

import { proxy } from "valtio";
import { derive } from "valtio/utils";

const state = proxy({ count: 0 });
const derived = derive(
  {
    double: (get) => get(state).count * 2,
  },
  { proxy: state }
);
$ tsc && vite build
node_modules/valtio/vanilla/utils/devtools.d.ts:1:63 - error TS2339: Property '__REDUX_DEVTOOLS_EXTENSION__' does not exist on type 'Window & typeof globalThis'.

This issue occurs with v1.10.6 (does not occur with v1.10.5) I guess #713 causes this error and the root cause is the same as https://github.com/pmndrs/zustand/issues/1205..

Link to reproduction

https://codesandbox.io/p/sandbox/modest-curran-ptlrl7

Check List

Please do not ask questions in issues.

Please include a minimal reproduction.