adopted-ember-addons / ember-cli-flash

Simple, highly configurable flash messages for ember-cli
https://www.npmjs.com/package/ember-cli-flash
MIT License
354 stars 113 forks source link

Error passing in unknown MessageOptions in TypeScript #381

Closed makalabay closed 2 years ago

makalabay commented 2 years ago

The flash service functions support a second argument (a hash of properties like sticky that get passed along without any filtering). However, adding custom properties (i.e. title) to that hash currently breaks in TypeScript compilation with the below error.

Argument of type '{ title: string; sticky: true; }' is not assignable to parameter of type 'Partial<MessageOptions>'.\n Object literal may only specify known properties, and 'title' does not exist in type 'Partial<MessageOptions>'.

While the flash objects contain all of the custom properties passed in, the type of MessageOptions is perpetually wrong, so it currently requires a ts-expect-error for this to compile, even though it works perfectly fine once it does compile.