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

Fix TypeScript errors from missing undefined or unprecise arrays #223

Merged
merged 3 commits into from
Jun 28, 2024

Conversation

rgieseke
Copy link
Contributor

Some time on a train, so here comes another TypeScript error message fix, basically I added |undefined to the type information whenever undefined is actually set.

This also how it's done in Svelte components itself, so I'm quite confident that that is reasonable.

/** @type {import('./types').MessageDetails | undefined} */
export let details = undefined;

/** @type {string | undefined} */
export let filename = undefined;

https://github.com/sveltejs/svelte/blob/33e44ea697356ea3f21fc6649919cf7fb4948b22/sites/svelte-5-preview/src/lib/Message.svelte#L8

I also turned some arrays into arrays of objects.

@mhkeller
Copy link
Owner

Great. I made some adjustments to the docs so the changes are reflected there, too. For data and flatData, I made those Array<any> since you could have arrays of arrays like in a stacked data structure.

@mhkeller
Copy link
Owner

mhkeller commented Jun 28, 2024

Let me know how this looks / if this is done. I'll put it through as a patch release since it improves the types on the LayerCake component itself.

@rgieseke
Copy link
Contributor Author

Wicked, thank you. Looks good to me!
Is there a script to update the docs (or way to check they match)?

@mhkeller
Copy link
Owner

Nope I don't have anything automated. Also what's not automated are the components in the REPL since I don't think there's any way to programmatically access svelte REPLs.

@mhkeller mhkeller merged commit cd16ba0 into mhkeller:main Jun 28, 2024
4 checks passed
@rgieseke rgieseke deleted the fix-undefined-and-array-ts-errors branch June 29, 2024 12:04
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