Overwrite/Extend type definition

Let’s say i have a type Screen, defined as such:

export type Screen = {
	gui: ScreenGui,
	closeButton: GuiButton,
	onVisibilityChanged: BindableEvent,

What if I wanted to make a type Unregistered that extended Screen, changing the type of onVisibilityChanged to a function: (v:boolean) -> nil and keeping the rest intact?

I tried to do:

export type Unregistered = Screen & {
	onVisibilityChanged: (v:boolean) -> nil

But the autocomplete still thought that onVisibilityChanged was a BindableEvent

How would I achieve this overwriting/extending effect with custom types?

Are you sure you are getting the Unregistered type, I am unsure if Roblox supports overriding properties when extending a type.

That’s what I’m unsure of too. I don’t know if the luau typedef system even allows this.

You can have a read through the Type checking - Luau page, I might have missed it, I did ask a few peeps I know and did not get a confirmation on if this works or not.