solid-refresh icon indicating copy to clipboard operation
solid-refresh copied to clipboard

overlapping type/function names are clobbered

Open tmm1 opened this issue 10 months ago • 2 comments

i'm working an complicated build pipeline where i added solid-refresh babel plugin, and encountered the following issue when solid-primitives/refs is processed:

solid-primitives/refs/refs.ts(98,9): Property 'ref' of exported interface has or is using private name 'Ref'.

comparing the generated files, you can see the difference:

w/out solid-refresh:

export type Ref<T> = T | ((el: T) => void) | undefined;
export interface RefProps<T> {
export function mergeRefs<T>(...refs: Ref<T>[]): (el: T) => void {
export function Refs(props: {
export function Ref(props: {

w/ solid-refresh:

export type Ref<T> = T | ((el: T) => void) | undefined;
export interface RefProps<T> {
export function mergeRefs<T>(...refs: Ref<T>[]): (el: T) => void {
export { Refs };
export { Ref };

Probably the solution and expected behavior is that library code like solid-primitives would not be processed via the solid-refresh babel pipeline?

tmm1 avatar Jan 13 '25 23:01 tmm1

Was struggling to edit my babel config to skip the solid-refresh plugin for this one file.

But then I realized I can just add a // @refresh skip to the top.

tmm1 avatar Jan 14 '25 01:01 tmm1

hmmm interesting, this is a good issue.

This happens because we hoist the functions at the top so we can wrap them later on with refresh, but never did I took TypeScript's same name feature into consideration

lxsmnsyc avatar Jan 14 '25 02:01 lxsmnsyc