-
Couldn't load subscription status.
- Fork 66
Open
Labels
Description
Неплохо было бы добавить проверку типов при установлении значений в реестре:
interface RegistryComponents {
ComponentName: ComponentType<ComponentProps>
}
const registry = new Registry<RegistryComponents>({ id: 'registry-id' })
// Component должен быть типом ComponentType<ComponentProps>
registry.set('component-key', Component)Но могут возникнуть проблемы при переопределении уже существующего реестра:
// Скорее всего ругнется, т.к. компонент EnhancedComponent будет иметь другой тип
registry.set('component-key', EnhancedComponent)belozer and bonkboykzbelozer