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

feat: add types #61

Merged
merged 7 commits into from
Oct 9, 2022
Merged

feat: add types #61

merged 7 commits into from
Oct 9, 2022

Conversation

Eomm
Copy link
Owner

@Eomm Eomm commented Oct 8, 2022

fixes #60

index.d.ts Outdated Show resolved Hide resolved
index.d.ts Outdated Show resolved Hide resolved
test/types/intex.test.ts Outdated Show resolved Hide resolved
index.d.ts Outdated Show resolved Hide resolved
test/types/intex.test-d.ts Outdated Show resolved Hide resolved
exposeRoute: true,
exposeRouteOptions: {
url: '/custom'
} as RouteOptions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is confusing me. If you do "as RouteOptions" then it means that even invalid values are handled as valid. So you should remove the "as RouteOptions". If e.g. RouteOptions has options you dont use, e.g. handler use Omit utility type. e.g. Omit<RouteOptions, 'handler'>

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked a bit the ts docs and the Partial structure works best as Omit does not let the user to customize those parameters

@Uzlopak
Copy link

Uzlopak commented Oct 8, 2022

Last nitpick:
You use commas in your type definitions. I assume that semicolons are the preferred way and i personally also prefer semicolons.

The typescript documentation uses semicolons everywhere and also a google search says that:
https://www.google.com/search?q=typescript+type+comma+or+semicolon&oq=typescript+types+comma+o&aqs=chrome.1.69i57j0i22i30.7144j0j4&client=ms-android-samsung-gj-rev1&sourceid=chrome-mobile&ie=UTF-8

But that is something you can decide.

@Eomm Eomm merged commit e88db78 into main Oct 9, 2022
@Eomm Eomm deleted the ts branch October 9, 2022 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add typescript type
2 participants