Skip to content

Making publishOnce and stream types consistent?#34

Open
ceigey wants to merge 3 commits intojamauro:mainfrom
ceigey:main
Open

Making publishOnce and stream types consistent?#34
ceigey wants to merge 3 commits intojamauro:mainfrom
ceigey:main

Conversation

@ceigey
Copy link
Copy Markdown

@ceigey ceigey commented Feb 9, 2026

I'm not sure if I've done this correctly but I noticed an issue with the publishOnce type (seemingly missing a parenthesis) and tried fixing it in slightly contradictory ways (check the commit history). In the end I just made the type consistent with stream but I'm not sure that's how it's meant to be, looking at the actual use cases.

Perhaps the void I've got there should be an any, to make things a bit neater.

.meteor/local/types/node_modules/package-types/jam_pub-sub/package/web.cordova/pub-sub.d.ts:38:76 - error TS1005: '=>' expected.

38 export declare function publishOnce(name: string, handler: (...args: any[]): { [collectionName: string]: object[] };
                                                                              ~

.meteor/local/types/node_modules/package-types/jam_pub-sub/package/web.cordova/pub-sub.d.ts:38:95 - error TS1005: ']' expected.

38 export declare function publishOnce(name: string, handler: (...args: any[]): { [collectionName: string]: object[] };
                                                                                                 ~

.meteor/local/types/node_modules/package-types/jam_pub-sub/package/web.cordova/pub-sub.d.ts:38:103 - error TS1005: ',' expected.

38 export declare function publishOnce(name: string, handler: (...args: any[]): { [collectionName: string]: object[] };
                                                                                                         ~

.meteor/local/types/node_modules/package-types/jam_pub-sub/package/web.cordova/pub-sub.d.ts:38:104 - error TS1128: Declaration or statement expected.

38 export declare function publishOnce(name: string, handler: (...args: any[]): { [collectionName: string]: object[] };
                                                                                                          ~

.meteor/local/types/node_modules/package-types/jam_pub-sub/package/web.cordova/pub-sub.d.ts:38:113 - error TS1011: An element access expression should take an argument.

38 export declare function publishOnce(name: string, handler: (...args: any[]): { [collectionName: string]: object[] };
                                                                                                                   

.meteor/local/types/node_modules/package-types/jam_pub-sub/package/web.cordova/pub-sub.d.ts:38:115 - error TS1128: Declaration or statement expected.

38 export declare function publishOnce(name: string, handler: (...args: any[]): { [collectionName: string]: object[] };
                                                                                                                     ~

Ideally the types would better match the intended usage. Of which there seems to be...

  1. void
  2. a cursor
  3. an array of cursors

Fixing a typo in pub-sub.d.ts that caused publishOnce to trigger tsc errors in a Meteor project.
Fix return type of publishOnce function
@jamauro
Copy link
Copy Markdown
Owner

jamauro commented Feb 10, 2026

Thanks @ceigey!

Ideally the types would better match the intended usage. Of which there seems to be...

void
a cursor
an array of cursors

I agree. Any interest in updating this PR to include that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants