Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please export more types for use in a Typescript context #56

Closed
kristianmandrup opened this issue Jul 28, 2024 · 2 comments
Closed

Please export more types for use in a Typescript context #56

kristianmandrup opened this issue Jul 28, 2024 · 2 comments
Labels
enhancement New feature or request seen I've seen and read this issue and I'll try find some time soon to work on it.

Comments

@kristianmandrup
Copy link

I wanted to use the types such as:

export type SourceSelect<T = any> = (eventName: string) => import('svelte/store').Readable<string> & SourceSelected<T>;
export type Transformer<T = any> = (value: string) => T;
export type Jsonifier<T = any> = (or?: import("./types").JsonPredicate<any> | undefined) => import('svelte/store').Readable<null | T>;
export type SourceSelectedTransform<T = any> = (transformer: Transformer<T>) => any;
export type SourceSelected<T = any> = {
    /**
     * Transform the data into a custom shape.
     */
    transform: SourceSelectedTransform<T>;
    /**
     * Parse the data as json.
     */
    json: Jsonifier<T>;
};
export type Source<T = any> = {
    close: () => void;
    /**
     * Select an event from the stream.
     */
    select: SourceSelect;
};

But I don't seem able to import them. The index.d.ts with the types looks as follows.

export * from "./types.js";
import { source } from './source.js';
import { produce } from './produce.js';
export { source, produce };

Looks like it would require an

export * from './source'
export * from './produce'

to make all the most relevant types available for both client and server.

@kristianmandrup kristianmandrup changed the title Unclear how to import and use the types in a Typescript context Export more types for use in a Typescript context Jul 28, 2024
@kristianmandrup kristianmandrup changed the title Export more types for use in a Typescript context Pleaseexport more types for use in a Typescript context Jul 28, 2024
@kristianmandrup kristianmandrup changed the title Pleaseexport more types for use in a Typescript context Please export more types for use in a Typescript context Jul 28, 2024
@razshare razshare added seen I've seen and read this issue and I'll try find some time soon to work on it. enhancement New feature or request labels Jul 28, 2024
@razshare
Copy link
Owner

Hello @kristianmandrup , thanks for the issue!

Looks like it would require an

export * from './source'
export * from './produce'

That I won't do.
A library should not expose internal types and confuse userland.
It has to be a manual process, not just export *.
I went through all the types and function/object signatures and identified all the types that are required for userland.

Please update to version 0.13.5 to get the latest changes.

There are some breaking changes because I found 2 types that haven't been updated for some time and needed a name change. See breaking changes in release notes.

Other than that, you should now have access to all the types you need.

Peek 2024-07-28 13-36


Let me know if this addresses your issue.

@razshare
Copy link
Owner

razshare commented Aug 9, 2024

I'm closing this issue due to inactivity.
Feel free to open a new one or follow up on this one if you need to.

@razshare razshare closed this as completed Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request seen I've seen and read this issue and I'll try find some time soon to work on it.
Projects
None yet
Development

No branches or pull requests

2 participants