Open lgarron opened 9 months ago
Confirmed I'm seeing the same exact errors in my project too. Thank you for reporting.
more info , fetch work bad, no lib.dom found.
but navigator seems ok
here is my config, bun version: 1.0.29
{
"compilerOptions": {
"target": "ES2020",
"moduleDetection": "force",
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"module": "ESNext",
"jsx": "react-jsx",
"strict": true,
"skipLibCheck": true,
"isolatedModules": true,
"resolveJsonModule": true,
"moduleResolution": "bundler",
"useDefineForClassFields": true,
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"noEmit": true,
"noFallthroughCasesInSwitch": true,
},
"include": ["src", "config", "plugins"]
}
package.json
{
"devDependencies": {
"@types/bun": "^1.0.8",
"typescript": "^5.3.0"
}
}
Experiencing same problem when running bunx tsc index.ts
with or without typescript module installed.
../../../../private/tmp/bunx-501-typescript@latest/node_modules/typescript/lib/lib.dom.d.ts:8183:11 - error TS2430: Interface 'EventSource' incorrectly extends interface 'Bun.EventSource'.
Types of property 'onerror' are incompatible.
Type '(this: EventSource, ev: Event) => any' is not assignable to type '(this: Bun.EventSource, ev: Event) => any'.
The 'this' types of each signature are incompatible.
Type 'Bun.EventSource' is not assignable to type 'EventSource'.
Types of property 'onmessage' are incompatible.
Type '(this: Bun.EventSource, ev: Bun.MessageEvent<any>) => any' is not assignable to type '(this: EventSource, ev: MessageEvent<any>) => any'.
Types of parameters 'ev' and 'ev' are incompatible.
Type 'MessageEvent<any>' is not assignable to type 'Bun.MessageEvent<any>'.
Types of property 'ports' are incompatible.
Type 'readonly MessagePort[]' is not assignable to type 'readonly import("worker_threads").MessagePort[]'.
Type 'MessagePort' is missing the following properties from type 'MessagePort': ref, unref, addListener, emit, and 13 more.
8183 interface EventSource extends EventTarget {
~~~~~~~~~~~
../../../../private/tmp/bunx-501-typescript@latest/node_modules/typescript/lib/lib.dom.d.ts:15520:11 - error TS2430: Interface 'MessageEvent<T>' incorrectly extends interface 'Bun.MessageEvent<T>'.
Types of property 'ports' are incompatible.
Type 'readonly MessagePort[]' is not assignable to type 'readonly import("worker_threads").MessagePort[]'.
15520 interface MessageEvent<T = any> extends Event {
~~~~~~~~~~~~
../../../../private/tmp/bunx-501-typescript@latest/node_modules/typescript/lib/lib.dom.d.ts:25534:11 - error TS2430: Interface 'WebSocket' incorrectly extends interface 'import("/Users/milev/development/js-pe/node_modules/@types/ws/index").WebSocket'.
Types of property 'binaryType' are incompatible.
Type 'BinaryType' is not assignable to type '"arraybuffer" | "nodebuffer" | "fragments"'.
Type '"blob"' is not assignable to type '"arraybuffer" | "nodebuffer" | "fragments"'.
25534 interface WebSocket extends EventTarget {
~~~~~~~~~
node_modules/@types/node/module.d.ts:283:13 - error TS2687: All declarations of 'dirname' must have identical modifiers.
283 dirname: string;
~~~~~~~
node_modules/@types/node/module.d.ts:289:13 - error TS2687: All declarations of 'filename' must have identical modifiers.
289 filename: string;
~~~~~~~~
node_modules/bun-types/globals.d.ts:1917:12 - error TS2687: All declarations of 'dirname' must have identical modifiers.
1917 readonly dirname: string;
~~~~~~~
node_modules/bun-types/globals.d.ts:1920:12 - error TS2687: All declarations of 'filename' must have identical modifiers.
1920 readonly filename: string;
~~~~~~~~
node_modules/bun-types/overrides.d.ts:3:20 - error TS2305: Module '"bun"' has no exported member 'PathLike'.
3 import type { Env, PathLike, BunFile } from "bun";
~~~~~~~~
Found 8 errors in 4 files.
Errors Files
3 ../../../../private/tmp/bunx-501-typescript@latest/node_modules/typescript/lib/lib.dom.d.ts:8183
2 node_modules/@types/node/module.d.ts:283
2 node_modules/bun-types/globals.d.ts:1917
1 node_modules/bun-types/overrides.d.ts:3
Modules installed
bun pm ls --all
node_modules
├── @types/bun@1.1.0
├── @types/node@20.11.30
├── @types/ws@8.5.10
├── bun-types@1.1.0
└── undici-types@5.26.5
yarn info -A
├─ @types/bun@npm:1.1.0
│ ├─ Version: 1.1.0
│ │
│ └─ Dependencies
│ └─ bun-types@npm:1.1.0 → npm:1.1.0
│
└─ js-pe@workspace:.
├─ Version: 0.0.0
│
└─ Dependencies
└─ @types/bun@npm:^1.1.0 → npm:1.1.0
Same issues as well
I got the error as well on Mac OS with @types/bun latest
Any workaround in a meantime? Would love to use bun:test
🙏
cc @Jarred-Sumner
Also different type for URL. i cant use URL with fetch...
Argument of type URL is not assignable to parameter of type string | Request | URL
still a bug
I'm getting the same issues with a project that doesnt even use bun but is part of a pnpm / turborepo project, which includes a project that uses bun.
Does anyone have a solution?
Same issues in a very basic TypeScript project with bun ...
Same issue here, unable to use bun:test because of this... :(
Also having trouble with it
Still happening :-(
~We migrated to Bun on an older project that still builds with tsc -b
on the build scripts. Adding tests folder to exclude
in tsconfig.json worked for us:~
Scratch that... As long as it's installed in node_modules
the build fails ☹️
Same issue
Same issue
same issue
same issue(
just use skipLibCheck
What version of Bun is running?
1.0.25+a8ff7be64
What platform is your computer?
Darwin 23.2.0 arm64 arm
What steps can reproduce the bug?
What is the expected behavior?
TypeScript runs successfully.
What do you see instead?
Additional information
Also see:
This prevents me from using
@types/bun
in projects where@types/node
is also needed. When I try to use@types/bun
incubing.js
, I get additional conflicts: