[@smui/common] TypeError for projects with exactOptionalPropertyTypes: true
#664
Open
Labels
bug
Something isn't working
Describe the bug
Hello, I have a TS project using SMUI and I want to turn on the
exactOptionalPropertyTypes
tsconfig option. The trouble is, since SMUI distributes TS source files, those get checked by the TS compiler as well, so the extra check gets applied to them as well... and it fails.I would like to stress that this is not a false positive - the extra check uncovers what is really a potential issue in
@smui/common
. See the following line:svelte-material-ui/packages/common/src/internal/dispatch.ts
Lines 15 to 18 in 19ea8ed
Here the
new CustomEvent
infers itsT
type from the type of thedetail
property - which with the extra check is more strictly inferred asT | undefined
- this is IMHO correct, because the property is marked as optional in the function signature...To Reproduce
Steps to reproduce the behavior:
@smui/common
in a project (install it from NPM)exactOptionalPropertyTypes
Expected behavior
No error
Actual behavior
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: