# Monaco clarification

**URL:** https://discourse.nodered.org/t/monaco-clarification/47004
**Category:** General
**Created:** [11 June 2021 01:41 UTC](https://discourse.nodered.org/t/monaco-clarification/47004 "2021-06-11T01:41:29Z")
**Posts on this page:** 1
**Showing post:** 32

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [16 June 2021 21:43 UTC](https://discourse.nodered.org/t/monaco-clarification/47004/32 "2021-06-16T21:43:25Z")

</div>

An official answer...

> The problem occurs because `.weekday` is required to be one of `"long" | "short" | "narrow"` but assigning the object literal to a variable first, with no further context, causes it to be widened to `string` , which TS then can't verify is compatible when you pass it to the function later. Passing the object literal directly works because contextual typing prevents the widening (i.e. TS can verify on the spot that you're passing a compatible string literal).

And a work around - use a JSdoc `@type` hint...

```javascript
/** @type {Intl.DateTimeFormatOptions} */
const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };

```

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/0/d02295cef9d43698da08a1a2a2dc7e8c30785d15.png)

---

_[View the full topic](https://discourse.nodered.org/t/monaco-clarification/47004)._
