Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: improve return type of getFirstDay() #784

Merged
merged 1 commit into from
Feb 6, 2025

Conversation

st3iny
Copy link
Contributor

@st3iny st3iny commented Jul 22, 2024

Nice to have after nextcloud/server#46592

@st3iny st3iny added type: documentation 📖 Improvements or additions to documentation 3. to review 3️⃣ Waiting for reviews labels Jul 22, 2024
@st3iny st3iny requested a review from susnux July 22, 2024 13:53
@st3iny st3iny self-assigned this Jul 22, 2024
@st3iny
Copy link
Contributor Author

st3iny commented Jul 22, 2024

 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 🙃

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

@susnux
Copy link
Contributor

susnux commented Jul 22, 2024

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
Copy link
Contributor

susnux commented Jul 22, 2024

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

@susnux susnux force-pushed the docs/improve-get-first-day-typing branch from f1036d7 to 23b3f08 Compare February 6, 2025 01:10
@susnux susnux merged commit 6f4ba94 into main Feb 6, 2025
14 checks passed
@susnux susnux deleted the docs/improve-get-first-day-typing branch February 6, 2025 01:12
@susnux susnux mentioned this pull request Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review 3️⃣ Waiting for reviews type: documentation 📖 Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants