Skip to content

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

(mrmime@1.0.0, typescript@4.6.3)

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