Skip to content

fix(ts-interface-generator): properly type getters for properties of type object and function #565

Open
wridgeu wants to merge 1 commit intoUI5:mainfrom
wridgeu:fix/properly-type-getters
Open

fix(ts-interface-generator): properly type getters for properties of type object and function #565
wridgeu wants to merge 1 commit intoUI5:mainfrom
wridgeu:fix/properly-type-getters

Conversation

@wridgeu
Copy link
Copy Markdown

@wridgeu wridgeu commented Apr 13, 2026

For types like object or function the default value was/is not respected when generating accessors. The getter would/is wrongly typed when no callbacks/fns are provided to control properties.

So that a definition of
someFunc: { type: "function", group: "Behavior", defaultValue: null }

correctly generates :
getSomeFunc(): Function | null;

instead of:
getSomeFunc(): Function

I'm not that deep in the code base but have noticed that not all types have tests (though, I patched this locally in a project of mine so ... it works) and also that this change could maybe live somewhere in function generateMethods. Cases like this one, albeit a rather unusual one, would not be covered today (probably rather a wrong definition in UI5 itself and thus user/dev error more more than anything else).

Some more examples of similar definitions within UI5 ...

So that a definition of
`someFunc: { type: "function", group: "Behavior", defaultValue: null }`

correctly generates :
`getSomeFunc(): Function | null;`
@wridgeu wridgeu changed the title fix(ts-interface-generator): properly type getters fix(ts-interface-generator): properly type getters for properties of type object and function Apr 13, 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.

1 participant