Repository navigation
Stricter typing across the library - #77
Merged
Merged
Conversation
…nst` in NC_CONSTANTS
Member
|
pretty much in favour of deleting code (but some could remain as placeholders in the meantime, only if, needed and planned). Is this good to go? |
lazarusA
reviewed
Nov 4, 2026
lazarusA
reviewed
Nov 4, 2026
Collaborator
Author
From my point of view this is good to go. As mentioned I am going to create more PRs to get rid of the remaining |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Mostly a typing cleanup. Behaviour should stay the same except for the fixes listed below. This is the first iteration of stricter types. The goal is to replace all occurrences of
anyin the end. This is not really a breaking change, but one could argue it is, as some of the types are now enforced.Changes
cpx2,rimraf) and added@types/emscripten. The hand-writtenanytypes for the Emscripten module and FS are replaced with the official types.toError()helper inerrors.ts, with tests. Allcatch (err: any)blocks now useunknownplustoError().AnyTypedArraymoved intotypes.tsand replaces the long typed-array unions it duplicated.NC_CONSTANTSis nowas const.FILE_MODEStable, with derivedFileMode/OpenMode/CreateModetypes.modeinDataset()and thefrom*factories, including the public wrappers inindex.ts, is nowFileModeinstead ofstring.NC_LONGLONG/NC_ULONGLONGentries from the getter maps. They are aliases ofNC_INT64/NC_UINT64and only became visible as errors afteras const.Fixes found along the way
number. Emscripten returns them asBigInt, which the old types hid.open()handles the worker path and the regular read path in one branch. Creating files works as before.Notes
TYPE_NAMESis commented out, since nothing used it.