webcontainer-core icon indicating copy to clipboard operation
webcontainer-core copied to clipboard

Typescript `compilerOptions.types` doesn't apply types

Open tom-sherman opened this issue 1 year ago • 1 comments

Describe the bug

I can't reference a different typescript declaration when it exists in node_modules.

Link to the blitz that caused the error

https://stackblitz.com/edit/vitejs-vite-ymbqrc?file=src%2FApp.tsx

Steps to reproduce

  1. Spin up a new typescript + react project
  2. Update to latest canary
  3. Add "types": ["react/canary"] to compilerOptions in tsconfig.json
  4. Try to access a API that exists only in React canary and not stable

Expected behavior

react/canary.d.ts should be applied

Parity with Local

Screenshots

image

Platform

Browser name  = Chrome
Full version  = 124.0.0.0
Major version = 124
navigator.appName = Netscape
navigator.userAgent = Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36
performance.memory = {
  "totalJSHeapSize": 116357453,
  "usedJSHeapSize": 93883557,
  "jsHeapSizeLimit": 4294705152
}
Hash = 41fbae16

Additional context

No response

tom-sherman avatar Apr 26 '24 17:04 tom-sherman

/// <reference types="react/canary" />

Works as a workaround

tom-sherman avatar Apr 26 '24 18:04 tom-sherman