Repository navigation
fix(types): nullable blocks as (() => T) | null; declare NativeObject.extend - #84
Merged
ammarahm-ed merged 1 commit intoOct 25, 2026
Merged
Conversation
….extend - The emitter wrote nullable callbacks as `() => void | null`, which TypeScript reads as a function returning void | null, so passing null (e.g. presentViewControllerAnimatedCompletion's completion) was a type error. They are parenthesized now. - extend() works on every native class at runtime but was undeclared. NativeObject.extend types overridden methods from the class, accepts protocol/exposed methods, and takes objc.ExtendOptions. - nativescript-rn configure no longer says Android typings are generated on demand: nativescript.gradle generates them unless -PnsGenerateTypings=false.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
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.
Split out of #77 (item 9 of the "NativeScript bugs" list in ng-native/ng-native#931).
Summary
() => void | null, which TypeScript reads as a function returningvoid | null. Passingnull, for examplepresentViewControllerAnimatedCompletion(vc, true, null), was a type error.NativeObject.extend.extend()works on every native class at runtime but wasn't declared. It is now declared withobjc.ExtendOptions. Overridden methods are typed from the class, and protocol and exposed methods are accepted.nativescript-rn configure. The next-steps hint said Android typings were generated on demand with-PnsGenerateTypings=true.nativescript.gradlegenerates them by default, so the hint now says that.Evidence
tsc --strictagainst freshly generated iOS 27.1 declarations (tested in #77, same change).presentViewControllerAnimatedCompletion(vc, true, null)andUIView.extend({...})fail to type-check.Merge Danger
Door: two-way
Blast Radius: generated
.d.tsfilesRegenerated declarations change shape for every nullable block parameter. Types become more permissive, never stricter.