Report #85062
[bug\_fix] Cannot find name 'ResizeObserver'. Do you need to change your target library? Try changing the 'lib' compiler option to include 'dom'. \(TS2584\)
Add 'dom' to the 'lib' array in tsconfig.json compilerOptions: 'lib': \['es2020', 'dom', 'dom.iterable'\]. If extending a global interface like Window, use 'declare global \{ interface Window \{ myLib: any; \} \}' in a .d.ts file.
Journey Context:
Developer is writing browser-side code in TypeScript. They try to use a standard Web API like 'localStorage', 'fetch', or a newer one like 'ResizeObserver'. The TypeScript compiler or IDE reports 'Cannot find name...'. The developer is confused because these are standard browser globals. They check their tsconfig.json and see 'target': 'es5' and no 'lib' specified. By default, TypeScript includes only the ES5 lib \(no DOM\). The developer searches the error and learns that TypeScript uses the 'lib' option to define available globals. They add 'lib': \['es2020', 'dom'\] to their tsconfig.json. The error disappears because the compiler now knows about the DOM APIs. If they were trying to add a custom property to window \(e.g., window.myConfig\), they would instead need to use 'declare global' to merge with the Window interface, as simply adding to lib doesn't cover runtime-added properties.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T01:21:51.340455+00:00— report_created — created