luisherranz / deepsignal

DeepSignal 🧶 - Preact signals, but using regular JavaScript objects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"Exported variable  X  has or is using name  DeepArray  from external module" typescript error

iamrommel opened this issue · comments

Can we somehow export the interface DeepArray so I won't be having the issue?

image

I take a look at the code and somehow the DeepArray was not exported.

image

Hey @iamrommel, thanks for reporting the issue.

I don't understand why TS is giving you that error, and I can't seem to be able to reproduce it either. Would you mind sharing a minimal repository with the error so I can take a look here?

A temporary workaround for this appears to be recasting. So, in the OP's case (I think):

export const useContext = () => useContextCore(context as DeepSignal<ContextType>)

I know for myself I had something like the following and was able to fix with casting:

const configuration = deepSignal<Configuration.Settings>({...});

export const useConfiguration = () => configuration as DeepSignalObject<Configuration.Settings>;

Only issue with this is that DeepSignalObject is ALSO not exported so I had to manually copy/paste it into my own file. Maybe just exporting the types to begin with would be the easiest fix?

DeepSignalArray and DeepSignalObject are internal and should not be used directly, only DeepSignal should be.

Would you mind forking this Stackblitz and reproducing the error so I can take a look to understand what's going on? Thanks! 🙂

I'm going to close this now, but feel free to reopen if you finally have a chance to reproduce the issue.