ExtractConstructor<T>
Extracts a constructor type from an interface that defines a constructor__, constructor2__, constructor3__, constructor4__, or constructor5__ method.
Prefers higher-numbered variants over lower-numbered ones when multiple are present, since higher-numbered variants represent deeper subclass constructors when ancestor classes already define lower-numbered ones.
The constructor[N]__ helpers are declared optional (constructor[N]__?), so matching is done via 'constructor[N]__' extends keyof T (which sees optional keys) combined with NonNullable (which strips the | undefined an optional member carries), rather than T extends \{ constructor[N]__(): … \} (which no longer matches an optional method). The final branch still accepts a function type passed directly (e.g. ExtractConstructor<App['constructor__']>), NonNullable likewise tolerating its optional | undefined.
Import:
import type { ExtractConstructor } from '@obsidian-typings/obsidian-public-latest';Example:
// From an interface:type AppCtor = ExtractConstructor<App>;
// From a constructor__ method type directly:type AppCtor = ExtractConstructor<App['constructor__']>;Signature:
export interface ExtractConstructor<T>Links to this page:
- AbstractInputSuggest
- AllPropertiesView
- AppMenuBarManager
- AudioView
- BacklinkComponent
- BaseComponent
- BasesController
- BasesLinkConstructor
- BasesQueryQueue
- BasesSearchMenu
- BookmarksPluginInstance
- CanvasIndex
- CapacitorAdapterFs
- CommandPaletteModal
- Component
- DeferredView
- EditableFileView
- Editor
- EditorSuggest
- EmbedComponent
- EmbeddedEditorView
- EmbedImageComponent
- EmbedMarkdownComponent
- EmbedPdfComponent
- EmbedVideoComponent
- EmptyView
- Events
- FileExplorerView
- FileSuggest
- FileView
- FuzzySuggestModal
- getViewConstructorByViewType
- GraphView
- HotkeysSettingTab
- ImageView
- InfoFileView
- ItemView
- MarkdownBaseView
- MarkdownEditView
- MarkdownPreviewEvents
- MarkdownRenderer
- MarkdownScrollableEditView
- MetadataEditor
- MetadataEditorProperty
- PdfView
- Plugin
- PluginSettingTab
- PopoverSuggest
- PrimitiveValue
- PropertyPropertyWidgetComponentComboBox
- ReleaseNotesView
- SearchView
- SettingTab
- SuggestModal
- TableCellEditor
- TableView
- TAbstractFile
- TagView
- TextFileView
- UnknownView
- Value
- VideoView
- View
- WidgetEditorView
- Window