joshnuss / svelte-persisted-store

A Svelte store that persists to localStorage

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Suggestion: Convert runtime deprecation notice to TS `@deprecated` annotation

EdricChan03 opened this issue ยท comments

Imo, converting the following console.warn deprecation notice to use TSDoc's @deprecated annotation would probably help surface the deprecation notice to end users without having to use it in the first place:

https://github.com/joshnuss/svelte-local-storage-store/blob/34b1994bd22180d704d7629938e9b27936aa375e/index.ts#L26

The function's code is stripped in the resulting generated type definitions, so it's hard to tell that it's actually deprecated:

// ...

declare function writable<T>(key: string, initialValue: T, options?: Options<T>): Writable<T>;
declare function persisted<T>(key: string, initialValue: T, options?: Options<T>): Writable<T>;

export { persisted, writable };

Something like the following should persist in the resulting definitions file:

/** @deprecated Use `persisted` instead */
export function writable(...)

Hi @EdricChan03 ,

Thanks for the suggestion!

I've opened a PR #185

๐ŸŽ‰ This issue has been resolved in version 0.6.0 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€