nextcloud-libraries / nextcloud-l10n

Nextcloud L10n helpers for apps and libraries https://npmjs.org/@nextcloud/l10n
https://nextcloud-libraries.github.io/nextcloud-l10n/
GNU General Public License v3.0
6 stars 4 forks source link

docs: improve return type of getFirstDay() #784

Open st3iny opened 3 months ago

st3iny commented 3 months ago

Nice to have after https://github.com/nextcloud/server/pull/46592

st3iny commented 3 months ago
 lib/date.ts:21:2 - error TS2322: Type 'number' is not assignable to type '0 | 2 | 1 | 3 | 4 | 5 | 6'.

21  return window.firstDay

I guess I have to adjust our typings library as well :upside_down_face:

Or would you accept a as any or as (0 | 1 | 2 | 3 | 4 | 5 | 6) workaround?

susnux commented 3 months ago

I guess I have to adjust our typings library as well 🙃

Please do so :)

Or would you accept a as any or as (0 | 1 | 2 | 3 | 4 | 5 | 6) workaround?

In addition to the typings change, yes please use as (0 | 1 | 2 | 3 | 4 | 5 | 6) :)

susnux commented 3 months ago

You can also just define a type alias like type WeekDay = 0 | 1 | ...