oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
74.17k stars 2.77k forks source link

bun-types overwrites base react elements #5891

Open chalabi2 opened 1 year ago

chalabi2 commented 1 year ago

What version of Bun is running?

1.0.2+37edd5a6e389265738e89265bcbdf2999cb81a49

What platform is your computer?

Darwin 22.4.0 arm64 arm

What steps can reproduce the bug?

  const handleSearchChange = (event: React.ChangeEvent<HTMLInputElement>) => {
    setSearchTerm(event.target.value.toLowerCase());
  };

Above is a basic handler for setting a constant to be the user input.

with bun-types installed it errors with, value does not exist on event

It works fine just throws a type error

What is the expected behavior?

It should have no error

What do you see instead?

It works fine just doesnt build without error

Additional information

No response

mstuercke commented 1 year ago

Still happens in 1.0.6

jjhiggz commented 1 year ago

Having the same issue! For context, it's happening with me in an an app that doesn't need "bun-types" for its runtime but references "bun-types" indirectly through importing the type schema from my backend in an edenTreaty like so:

import { edenTreaty } from "@elysiajs/eden/treaty";
import type { ElysiaApp } from "backend"; // this line is what breaks everything

export const treaty = edenTreaty<ElysiaApp>("http://localhost:3001");
The-Code-Monkey commented 11 months ago

@chalabi2 did you find a fix for this

murderteeth commented 10 months ago

I started having this problem when I started using bun for testing and had to configure tsconfig with "types": ["bun-types"].

This is how I got around the problem:

This way I'm still using the bun test runner, but my project can still build because the bun test types are subset of jest.