Previously createEvent function used a hacky method to make a parameter optional when it had undefined in its payload.
However, this method made TypeScript unable to infer the names of the parameters correctly.
TypeScript inferred the parameters as payload_0: string or payload_0?: undefined, which is not ideal.
To resolve this, changes were made so that TypeScript can correctly infer the parameter types alongside the inserted EventKey.
After the changes, the parameter types are correctly inferred as:
Now, it appears the same as the documentation. The documentation correctly showed overlay.close(overlayId: string) and overlay.closeAll(), but the code did not reflect this.
Here’s a visual comparison of the before and after:
Before:
After:
Let me know if you have any comment on this issue :)
Previously
createEvent
function used a hacky method to make a parameter optional when it hadundefined
in itspayload
. However, this method made TypeScript unable to infer the names of the parameters correctly.This resulted in issues such as:
TypeScript inferred the parameters as
payload_0: string
orpayload_0?: undefined
, which is not ideal. To resolve this, changes were made so that TypeScript can correctly infer the parameter types alongside the insertedEventKey
.After the changes, the parameter types are correctly inferred as:
Now, it appears the same as the documentation. The documentation correctly showed
overlay.close(overlayId: string)
andoverlay.closeAll()
, but the code did not reflect this.Here’s a visual comparison of the before and after:
Before:
After:
Let me know if you have any comment on this issue :)