Skip to content

fix(types): fetch method should not return void but undefined instead#303

Merged
isaacs merged 1 commit intoisaacs:mainfrom
Thenkei:main
Jun 15, 2023
Merged

fix(types): fetch method should not return void but undefined instead#303
isaacs merged 1 commit intoisaacs:mainfrom
Thenkei:main

Conversation

@Thenkei
Copy link
Copy Markdown
Contributor

@Thenkei Thenkei commented May 31, 2023

Linked to the issue #302

Comment thread src/index.ts
Comment thread src/index.ts
@Thenkei
Copy link
Copy Markdown
Contributor Author

Thenkei commented May 31, 2023

The test suite is now running correctly locally.

@isaacs
Copy link
Copy Markdown
Owner

isaacs commented Jun 1, 2023

This patch would allow the fetchMethod to still return void, but I don't think there's any way around the SemVer major LRUCache.fetch type signature change.

isaacs pushed a commit to Thenkei/node-lru-cache that referenced this pull request Jun 6, 2023
PR-URL: isaacs#303
Credit: @Thenkei
Close: isaacs#303
Reviewed-by: @isaacs

EDIT(@isaacs): edited to continue to allow `fetchMethod` to return
`Promise<void>`.

BREAKING CHANGE: public method type signature change
isaacs pushed a commit to Thenkei/node-lru-cache that referenced this pull request Jun 15, 2023
PR-URL: isaacs#303
Credit: @Thenkei
Close: isaacs#303
Reviewed-by: @isaacs

EDIT(@isaacs): updated to preserve `fetchMethod`'s ability to return
`void`.

BREAKING CHANGE: change to public type signature
PR-URL: isaacs#303
Credit: @Thenkei
Close: isaacs#303
Reviewed-by: @isaacs

EDIT(@isaacs): edited to continue to allow `fetchMethod` to return
`Promise<void>`.

BREAKING CHANGE: public method type signature change
@isaacs isaacs merged commit ca4ea17 into isaacs:main Jun 15, 2023
@Thenkei
Copy link
Copy Markdown
Contributor Author

Thenkei commented Jun 20, 2023

Thank you so much @isaacs. 🙏

I hope it will help other TS users too.

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