mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 03:29:00 +01:00
Use .?method() in more places (#152112)
Switches simple patterns like:
```ts
if (some.thing) {
some.thing.method();
}
```
to:
```ts
some.thing?.method()
```
This is more concise and avoids having to repeat the `some.thing` part
This commit is contained in:
@@ -51,9 +51,7 @@ export function anyEvent<T>(...events: Event<T>[]): Event<T> {
|
||||
return (listener: (e: T) => any, thisArgs?: any, disposables?: Disposable[]) => {
|
||||
const result = combinedDisposable(events.map(event => event(i => listener.call(thisArgs, i))));
|
||||
|
||||
if (disposables) {
|
||||
disposables.push(result);
|
||||
}
|
||||
disposables?.push(result);
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user