Skip to content

fix: lookup returns undefined, not void #5

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

Merged
merged 1 commit into from
Dec 20, 2023

Conversation

willstott101
Copy link
Contributor

In this context, the lookup function returning undefined is information - it is a union of Some(data) | None.

Void should be used for functions that really return no data.

This has practical implications as in typescript, a property typed string | undefined cannot have string | void assigned to it.

src/entity/create.ts:160:11 - error TS2322: Type 'string | void' is not assignable to type 'string | undefined'.
  Type 'void' is not assignable to type 'string | undefined'.

160           type: mrmime.lookup(name),
              ~~~~


Found 1 error in src/entity/create.ts:160

([email protected], [email protected])

In this context, the lookup function returning `undefined` is information - it is a union of Some(data) | None. Void should be used for functions that really return no data.
This has practical implications as in typescript, a property typed `string | undefined` cannot have `string | void` assigned to it.
@lukeed lukeed merged commit 3218148 into lukeed:master Dec 20, 2023
@willstott101 willstott101 deleted the patch-1 branch December 24, 2023 14:56
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