Skip to content

fix(core): allow null for BrowserView.ptr type null assignment#350

Merged
YoavCodes merged 2 commits intoblackboardsh:mainfrom
AhmedNAgy25:fix/browserview-null-pointer-type
Apr 19, 2026
Merged

fix(core): allow null for BrowserView.ptr type null assignment#350
YoavCodes merged 2 commits intoblackboardsh:mainfrom
AhmedNAgy25:fix/browserview-null-pointer-type

Conversation

@AhmedNAgy25
Copy link
Copy Markdown
Contributor

What

Fixes a TypeScript type safety issue in BrowserView by properly allowing null values for the ptr property.

  • Changed ptr from Pointer! (non-null assertion) to Pointer | null = null
  • Removed null as any type hack in the remove() method

Why

The ptr property represents a native pointer that becomes invalid after remove() is called. The previous code set it to null but the type didn't reflect this, requiring a type cast hack (as any) to work around TypeScript.

This fix:

  • Makes the types accurately represent the runtime behavior
  • Removes the type hack for cleaner code
  • Prevents potential runtime errors from improper null handling

AhmedNAgy25 and others added 2 commits March 27, 2026 01:15
- Change ptr from 'Pointer!' to 'Pointer | null = null'
- Remove 'as any' type hack when setting ptr to null in remove()
- Improves TypeScript type safety
Copy link
Copy Markdown
Member

@YoavCodes YoavCodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@YoavCodes YoavCodes merged commit 590b934 into blackboardsh:main Apr 19, 2026
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