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

Date & '' - Shape Mismatch #12

Open
ross1296 opened this issue Oct 9, 2024 · 0 comments
Open

Date & '' - Shape Mismatch #12

ross1296 opened this issue Oct 9, 2024 · 0 comments

Comments

@ross1296
Copy link

ross1296 commented Oct 9, 2024

Me again. You'll be getting sick of my issues.

I'm just wondering about how Date should be handled in the DeepPartial and DeepRequired.

If I, for example, have a model with

export type ExampleModel = DeepPartial<{
    dateOfBirth: Date;
}>

And the DeepRequired is:

export const exampleModelShape = DeepRequired<ExampleModel> = {
    dateOfBirth: ''
}

Then, understandably, this is a shape mismatch because Date != string, but setting the initial value to '' is a valid approach when wanting to avoid rendering a value in your DatePicker and instead opting to show your placeholder text. PrimeNG's p-calendar is a great example of this. If you want to show your placeholder, then your value must be ''.

Are we safe to just ignore the shape mismatch errors in this scenario, albeit it does spam the console endlessly, or is there a graceful way to approach this?

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

No branches or pull requests

1 participant