Skip to content

Commit cb20745

Browse files
sandersnorta
andauthored
Always emit "| undefined" for optional properties (#1092)
Co-authored-by: Orta Therox <[email protected]> Co-authored-by: Orta Therox <[email protected]>
1 parent a932541 commit cb20745

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

baselines/dom.generated.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5896,10 +5896,10 @@ interface GlobalEventHandlers {
58965896
*/
58975897
ontimeupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null;
58985898
ontoggle: ((this: GlobalEventHandlers, ev: Event) => any) | null;
5899-
ontouchcancel?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null;
5900-
ontouchend?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null;
5901-
ontouchmove?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null;
5902-
ontouchstart?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null;
5899+
ontouchcancel?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
5900+
ontouchend?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
5901+
ontouchmove?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
5902+
ontouchstart?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
59035903
ontransitioncancel: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
59045904
ontransitionend: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
59055905
ontransitionrun: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;

src/build/emitter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ export function emitWebIdl(
791791
} else {
792792
pType = convertDomTypeToTsType(p);
793793
}
794-
if (p.optional && prefix) {
794+
if (p.optional) {
795795
pType += " | undefined";
796796
}
797797
const optionalModifier = !p.optional || prefix ? "" : "?";

0 commit comments

Comments
 (0)