solidjs / solid

A declarative, efficient, and flexible JavaScript library for building user interfaces.
https://solidjs.com
MIT License
32.47k stars 927 forks source link

Export types mismatch #2224

Closed illiaChaban closed 4 months ago

illiaChaban commented 4 months ago

Describe the bug

I'm using typescript and able to import "effect" from "solid-js/web"

import { effect } from "solid-js/web";

effect;

If I use it in any way I get "The requested module 'solid-js/web' does not provide an export named 'effect'" error. Seems like types specify this export, but it doesn't actually exist

Types:

image

Your Example Website or App

https://stackblitz.com/edit/github-f45fb5-pkhx6p?file=src%2Froutes%2Findex.tsx

Steps to Reproduce the Bug or Issue

import { effect } from "solid-js/web";

effect;

Expected behavior

No error or no available export

Screenshots or Videos

image

Platform

Additional context

No response

Brendan-csel commented 4 months ago

Perhaps you want createEffect?

or maybe import { type effect } from 'solid-js/web'; if you just want the type?

illiaChaban commented 4 months ago

No, I just like the shorter name vs createEffect and noticed that it was available.

Brendan-csel commented 4 months ago

Yeah - a different (internal use) thing I think. Probably best to stick with createEffect :)

ryansolid commented 4 months ago

Yeah this is internal used by the compiler and not intended for outside use. Under the hood it actually doesn't use createEffect and uses createRenderEffect. We need to export these helpers for the compiled output but the signature could be different and have different behavior.