Skip to content

Commit 47e54ae

Browse files
committed
Return undefined instead of null
1 parent 4eb2bf3 commit 47e54ae

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

src/vs/workbench/browser/editor.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ export interface IEditorRegistry {
3434
registerEditor(descriptor: IEditorDescriptor, editorInputDescriptor: SyncDescriptor<EditorInput>[]): void;
3535

3636
/**
37-
* Returns the editor descriptor for the given input or null if none.
37+
* Returns the editor descriptor for the given input or `undefined` if none.
3838
*/
39-
getEditor(input: EditorInput): IEditorDescriptor | null;
39+
getEditor(input: EditorInput): IEditorDescriptor | undefined;
4040

4141
/**
4242
* Returns the editor descriptor for the given identifier or null if none.
4343
*/
44-
getEditorById(editorId: string): IEditorDescriptor | null;
44+
getEditorById(editorId: string): IEditorDescriptor | undefined;
4545

4646
/**
4747
* Returns an array of registered editors known to the platform.
@@ -104,12 +104,12 @@ class EditorRegistry implements IEditorRegistry {
104104
this.editors.push(descriptor);
105105
}
106106

107-
getEditor(input: EditorInput): EditorDescriptor | null {
107+
getEditor(input: EditorInput): EditorDescriptor | undefined {
108108
const findEditorDescriptors = (input: EditorInput, byInstanceOf?: boolean): EditorDescriptor[] => {
109109
const matchingDescriptors: EditorDescriptor[] = [];
110110

111111
for (const editor of this.editors) {
112-
const inputDescriptors: SyncDescriptor<EditorInput>[] | undefined = this.mapEditorToInputs.get(editor);
112+
const inputDescriptors = this.mapEditorToInputs.get(editor);
113113
if (inputDescriptors) {
114114
for (const inputDescriptor of inputDescriptors) {
115115
const inputClass = inputDescriptor.ctor;
@@ -154,17 +154,17 @@ class EditorRegistry implements IEditorRegistry {
154154
return descriptors[0];
155155
}
156156

157-
return null;
157+
return undefined;
158158
}
159159

160-
getEditorById(editorId: string): EditorDescriptor | null {
160+
getEditorById(editorId: string): EditorDescriptor | undefined {
161161
for (const editor of this.editors) {
162162
if (editor.getId() === editorId) {
163163
return editor;
164164
}
165165
}
166166

167-
return null;
167+
return undefined;
168168
}
169169

170170
getEditors(): EditorDescriptor[] {

0 commit comments

Comments
 (0)