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

Change TDate to an extendable type #603

Merged
merged 2 commits into from
Jan 25, 2022

Conversation

selenehyun
Copy link
Contributor

@selenehyun selenehyun commented Jan 25, 2022

This change gives you an advantage when developing with date-io.

If you extend the type as shown below in a project using date-io, you can set the Opaque type so that the Date value is not directly referenced.

declare module '@date-io/core' {
  type Opaque<K, T> = T & { __TYPE__: K };

  interface ExtendableDateType extends Opaque<'DateType', unknown> {}
}

This allows me to take advantage of TypeScript more powerfully by not dealing with the any type.

@dmtrKovalenko dmtrKovalenko merged commit 887a6fe into dmtrKovalenko:master Jan 25, 2022
@selenehyun selenehyun deleted the extendable-date-type branch January 26, 2022 03:46
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.

2 participants