Back to Intellij Community

NonNullableBooleanPropertyInExternalInterface

plugins/kotlin/code-insight/descriptions/resources-en/inspectionDescriptions/NonNullableBooleanPropertyInExternalInterface.html

2025.3-rc-2517 B
Original Source

Reports non-nullable Boolean properties in external interfaces in Kotlin/JS projects.

Boolean properties in external interfaces should be nullable to handle cases where the JavaScript value might be undefined.

Example:

external interface MyInterface {
    var enabled: Boolean // Warning: should be Boolean?
    var visible: Boolean // Warning: should be Boolean?
}

After the quick-fix is applied:

external interface MyInterface {
    var enabled: Boolean?
    var visible: Boolean?
}