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

the type of childNodes is not comprehensive #342

Open
0xDatapunk opened this issue Oct 7, 2024 · 0 comments
Open

the type of childNodes is not comprehensive #342

0xDatapunk opened this issue Oct 7, 2024 · 0 comments
Labels
audit 🔍 This issue is related to an audit. refactoring ♻️ A code change that neither fixes a bug nor adds a feature

Comments

@0xDatapunk
Copy link
Collaborator

const childNodes = this.nodes.get(node) as ChildNodes

here childNodes could be a leaf node of Entry type ([Key, Value, EntryMark]). However, the type system is defined as:
private nodes: Map<Node, ChildNodes>
export type ChildNodes = Node[]
export type Node = string | bigint

A more accurate system would be:
export type Node = string | bigint
export type InternalChildNodes = [Node, Node]
export type LeafChildNodes = [Key, Value, EntryMark]
export type ChildNodes = InternalChildNodes | LeafChildNodes
private nodes: Map<Node, ChildNodes>

@cedoor cedoor added audit 🔍 This issue is related to an audit. refactoring ♻️ A code change that neither fixes a bug nor adds a feature labels Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
audit 🔍 This issue is related to an audit. refactoring ♻️ A code change that neither fixes a bug nor adds a feature
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants