From 1905e7bf7e859797689178a67184a3f07e04c00c Mon Sep 17 00:00:00 2001 From: Andrei Fangli Date: Thu, 17 Oct 2024 17:29:26 +0300 Subject: [PATCH] Added type alias documentation --- docs.ts | 171 ++++++++++++++++-- src/dependencies/DependencyContainer.ts | 17 +- src/dependencies/DependencyResolverContext.ts | 30 ++- src/dependencies/IDependencyContainer.ts | 25 ++- src/dependencies/IDependencyResolver.ts | 65 ++++++- src/dependencies/UseDependency.ts | 24 ++- src/dependencies/UseViewModelDependency.ts | 23 ++- src/forms/IConfigurableFormCollection.ts | 7 +- src/index.ts | 1 + 9 files changed, 323 insertions(+), 40 deletions(-) diff --git a/docs.ts b/docs.ts index 2e04779..09989a9 100644 --- a/docs.ts +++ b/docs.ts @@ -27,23 +27,37 @@ void async function () { if (project.children) await Promise.all(project.children.map(async declaration => { + const subDirectory1 = declaration.sources?.at(0)?.fileName.split('/').at(0); + let subDirectory2: string; let documentation: string | null = null; switch (declaration.kind) { + case ReflectionKind.TypeAlias: + subDirectory2 = 'aliases'; + documentation = getAliasDocumentation(declaration); + break; + case ReflectionKind.Interface: + subDirectory2 = 'interfaces'; documentation = getInterfaceDocumentation(declaration); break; case ReflectionKind.Class: + subDirectory2 = 'classes'; documentation = getClassDocumentation(declaration); break; case ReflectionKind.Function: + subDirectory2 = 'functions'; documentation = getFunctionDocumentation(declaration); break; } - if (documentation !== null) - await writeFileAsync(path.join(outputDirectory, `${getIdentifier(declaration)}.md`), documentation); + if (documentation !== null) { + const directoryPath = path.join(outputDirectory, subDirectory1!, subDirectory2!); + + await mkdirAsync(directoryPath, { recursive: true }); + await writeFileAsync(path.join(directoryPath, `${getIdentifier(declaration)}.md`), documentation); + } })); function findDeclaration(target: Reflection | ReflectionSymbolId | string | undefined): DeclarationReflection { @@ -58,6 +72,32 @@ void async function () { return declaration; } + function getAliasDocumentation(aliasDeclaration: DeclarationReflection): string { + return ` +###### [API](https://github.com/Andrei15193/react-model-view-viewmodel/wiki#api) / ${getFullName(aliasDeclaration)} alias + +${getDeprecationNotice(aliasDeclaration)} + +${getSummary(aliasDeclaration)} + +\`\`\`ts +${getDeclaration(aliasDeclaration)} +\`\`\` + +${getSourceCodeLink(aliasDeclaration)} + +${getGenericParameters(aliasDeclaration)} + +${getDescription(aliasDeclaration)} + +${getRemarks(aliasDeclaration)} + +${getGuidance(aliasDeclaration)} + +${getReferences(aliasDeclaration)} +`.replace(/\n{3,}/g, '\n\n').trim(); + } + function getInterfaceDocumentation(interfaceDeclaration: DeclarationReflection): string { return ` ###### [API](https://github.com/Andrei15193/react-model-view-viewmodel/wiki#api) / ${getFullName(interfaceDeclaration)} interface @@ -195,6 +235,7 @@ ${getReferences(functionSignature)} case ReflectionKind.Method: return declaration.parent!.name + '.' + getSimpleName(declaration); + case ReflectionKind.TypeAlias: case ReflectionKind.Class: case ReflectionKind.Interface: case ReflectionKind.Function: @@ -239,6 +280,56 @@ ${getReferences(functionSignature)} function getDeclaration(declaration: DeclarationReflection | SignatureReflection): string { switch (declaration.kind) { + case ReflectionKind.TypeAlias: + let aliasDeclaration = `type ${declaration.name}`; + + if (declaration.typeParameters && declaration.typeParameters.length > 0) + aliasDeclaration += `<${declaration.typeParameters.map(getTypeParameterDeclaration).join(', ')}>`; + + switch (declaration.type?.type) { + case 'union': + return aliasDeclaration + + '\n= ' + + declaration + .type + .types + .map(type => { + if (type.type === 'tuple') + return `[\n ${type.elements.map(getTypeReferenceDeclaration).join(',\n ')}\n ]`; + else + return getTypeReferenceDeclaration(type); + }) + .join('\n| ') + + ';'; + + case 'reflection': + if ( + declaration.type.declaration.kind === ReflectionKind.TypeLiteral + && declaration.type.declaration.signatures + && declaration.type.declaration.signatures.length === 1 + && declaration.type.declaration.signatures.at(0)!.name === declaration.type.declaration.name + ) + return aliasDeclaration + '\n = ' + getTypeReferenceDeclaration(declaration.type!) + ';'; + else + return aliasDeclaration + ' = ' + getTypeReferenceDeclaration(declaration.type!) + ';'; + + case 'indexedAccess': + return aliasDeclaration + '\n = ' + getTypeReferenceDeclaration(declaration.type!) + ';'; + + default: + throw new Error(`Unhandled '${declaration.type?.type}' declaration type.`); + } + + case ReflectionKind.Interface: + let interfaceDeclaration = `interface ${declaration.name}`; + + if (declaration.typeParameters && declaration.typeParameters.length > 0) + interfaceDeclaration += `<${declaration.typeParameters.map(getTypeParameterDeclaration).join(', ')}>`; + if (declaration.extendedTypes && declaration.extendedTypes.length > 0) + interfaceDeclaration += `\n extends ${declaration.extendedTypes.map(getTypeReferenceDeclaration).join(', ')}`; + + return interfaceDeclaration; + case ReflectionKind.Class: let classDeclaration = `class ${declaration.name}`; @@ -254,16 +345,6 @@ ${getReferences(functionSignature)} return classDeclaration; - case ReflectionKind.Interface: - let interfaceDeclaration = `interface ${declaration.name}`; - - if (declaration.typeParameters && declaration.typeParameters.length > 0) - interfaceDeclaration += `<${declaration.typeParameters.map(getTypeParameterDeclaration).join(', ')}>`; - if (declaration.extendedTypes && declaration.extendedTypes.length > 0) - interfaceDeclaration += `\n extends ${declaration.extendedTypes.map(getTypeReferenceDeclaration).join(', ')}`; - - return interfaceDeclaration; - case ReflectionKind.CallSignature: let functionDeclaration = 'function ' + declaration.name; @@ -322,9 +403,67 @@ ${getReferences(functionSignature)} case 'reference': return `${typeReference.name}${typeReference.typeArguments && typeReference.typeArguments.length > 0 ? `<${typeReference.typeArguments.map(getTypeReferenceDeclaration).join(', ')}>` : ''}`; + case 'reflection': + switch (typeReference.declaration.kind) { + case ReflectionKind.TypeAlias: + case ReflectionKind.Class: + case ReflectionKind.Interface: + let typeReferenceDeclaration = typeReference.declaration.name; + if (typeReference.declaration.typeParameters && typeReference.declaration.typeParameters.length > 0) { + typeReferenceDeclaration += '<'; + typeReferenceDeclaration += typeReference + .declaration + .typeParameters + .map(genericParameter => getTypeReferenceDeclaration(genericParameter.type!)) + .join(', '); + typeReferenceDeclaration += '>'; + } + + return typeReferenceDeclaration; + + case ReflectionKind.TypeLiteral: + if (typeReference.declaration.type) + return getTypeReferenceDeclaration(typeReference.declaration.type); + else if (typeReference.declaration.signatures) { + if (typeReference.declaration.signatures.length === 1 && typeReference.declaration.signatures.at(0)!.name === typeReference.declaration.name) { + const signature = typeReference.declaration.signatures.at(0)! + return `(${(signature.parameters || []).map(getParameterDeclaration).join(', ')}) => ${getTypeReferenceDeclaration(signature.type!)}`; + } + else { + let signaturesDeclarations = '{\n '; + signaturesDeclarations += typeReference + .declaration + .signatures + .map(signature => { + if (signature.kind === ReflectionKind.ConstructorSignature) + return `new (${(signature.parameters || []).map(getParameterDeclaration).join(', ')}): ${getTypeReferenceDeclaration(signature.type!)};`; + else { + const genericTypeDeclaration = signature.typeParameters?.map(getTypeParameterDeclaration).join(', ') || ''; + return `${signature.name}${genericTypeDeclaration.length > 0 ? '<' + genericTypeDeclaration + '>' : ''}(${(signature.parameters || []).map(getParameterDeclaration).join(', ')}): ${getTypeReferenceDeclaration(signature.type!)};`; + } + }) + .join('\n '); + signaturesDeclarations += '\n}'; + + return signaturesDeclarations; + } + } + else + throw new Error(`Unhandled '${typeReference.declaration}' type literal reflection reference declaration.`); + + case ReflectionKind.IndexSignature: + return typeReference.declaration.name; + + default: + throw new Error(`Unhandled '${typeReference.declaration}' reflection reference declaration.`); + } + case 'intersection': return typeReference.types.map(getTypeReferenceDeclaration).join(' | '); + case 'union': + return typeReference.types.map(getTypeReferenceDeclaration).join(' | '); + case 'intrinsic': return typeReference.name; @@ -350,9 +489,6 @@ ${getReferences(functionSignature)} case 'typeOperator': return `${typeReference.operator} ${getTypeReferenceDeclaration(typeReference.target)}`; - case 'union': - return typeReference.types.map(getTypeReferenceDeclaration).join(' | '); - case 'array': switch (typeReference.elementType.type) { case 'reference': @@ -371,6 +507,9 @@ ${getReferences(functionSignature)} else throw new Error('Unhandled predicate type declaration.'); + case 'indexedAccess': + return getTypeReferenceDeclaration(typeReference.objectType) + `[${getTypeReferenceDeclaration(typeReference.indexType)}]`; + default: throw new Error(`Unhandled '${typeReference.type}' type declaration.`); } @@ -777,7 +916,7 @@ ${getReferences(functionSignature)} function getReferences(declaration: DeclarationReflection | SignatureReflection): string { const references = declaration.comment?.blockTags.filter(blockTag => blockTag.tag === '@see') || []; if (references.length > 0) - return '### See also\n\n' + references.reduce((result, reference) => result + `* ${getBlock(reference.content)}\n`, ''); + return '### See also\n\n' + references.map(reference => getBlock(reference.content).replace(/^[ \t]-/gm, '*')).join('\n'); else return ''; } diff --git a/src/dependencies/DependencyContainer.ts b/src/dependencies/DependencyContainer.ts index d977fe9..eb255c6 100644 --- a/src/dependencies/DependencyContainer.ts +++ b/src/dependencies/DependencyContainer.ts @@ -184,24 +184,27 @@ export class DependencyContainer implements IDependencyContainer, IDependencyRes /** * Resolves a dependency based on its configuration, if any. All unconfigured dependencies are transient. + * + * @template T The dependency type to resolve. + * * @param dependency The dependnecy to resolve. + * * @returns The resolved dependency. */ public resolve(dependency: ResolvableSimpleDependency): T; /** * Resolves a complex dependency. All such dependencies are transient as they require * additional dependencies on the constructor. + * + * @template T The dependency type to resolve. + * @template TAdditional A tuple representing additional parameters required by the constructor. + * * @param dependency The complex dependnecy to resolve. * @param additionalDependencies Additional dependencies requested by the constructor besides the dependency resolver. - * @returns The resolved dependency. + * + * @returns The resolved dependency. */ public resolve(dependency: ComplexDependency, additionalDependencies: TAdditional): T; - /** - * Resolves a dependency based on its configuration. All complex dependencies are transient, all unconfigured dependencies are transient. - * @param dependency The dependency to resolve. - * @param additionalDependencies Additional dependencies requested by the constructor besides the dependency resolver. - */ - public resolve(dependency: ResolvableSimpleDependency | ComplexDependency, additionalDependencies: TAdditional): T; public resolve(dependency: ResolvableSimpleDependency | ComplexDependency, additionalDependencies?: TAdditional): T { try { diff --git a/src/dependencies/DependencyResolverContext.ts b/src/dependencies/DependencyResolverContext.ts index 3ea85fb..f4feed4 100644 --- a/src/dependencies/DependencyResolverContext.ts +++ b/src/dependencies/DependencyResolverContext.ts @@ -1,4 +1,6 @@ -import type { IDependencyResolver } from "./IDependencyResolver"; +import type { IDependencyResolver, ResolvableSimpleDependency } from "./IDependencyResolver"; +import type { IDependencyContainer, ConfigurableDependency } from "./IDependencyContainer"; +import type { useDependency } from './UseDependency'; import { DependencyContainer } from "./DependencyContainer"; import { type PropsWithChildren, createContext, createElement, useContext, useMemo, useRef } from "react"; @@ -6,7 +8,16 @@ const DependencyResolverContext = createContext(new Depende /** * Gets the currently configured dependency resolver. + * * @returns Returns the currently configured dependency resolver. + * + * @see {@link IDependencyResolver} + * @see {@link IDependencyContainer} + * @see {@link ConfigurableDependency} + * @see {@link ResolvableSimpleDependency} + * @see {@link useDependency} + * @see {@link DependencyResolverProvider} + * @see {@link DependencyResolverScope} */ export function useDependencyResolver(): IDependencyResolver { return useContext(DependencyResolverContext); @@ -14,6 +25,8 @@ export function useDependencyResolver(): IDependencyResolver { /** * Represents the dependency resolver context provider props. + * + * @see {@link DependencyResolverProvider} */ export interface IDependencyResolverProviderProps { /** @@ -24,8 +37,15 @@ export interface IDependencyResolverProviderProps { /** * Configures a dependency resolver in the context of child components. + * + * @returns Returns the `children` in the context of the provided `dependencyResolver`. + * + * @see {@link IDependencyResolver} + * @see {@link IDependencyContainer} + * @see {@link useDependency} */ -export function DependencyResolverProvider({ dependencyResolver, children }: PropsWithChildren): JSX.Element { +export function DependencyResolverProvider(props: PropsWithChildren): JSX.Element { + const { dependencyResolver, children } = props; return createElement(DependencyResolverContext.Provider, { value: dependencyResolver, children @@ -34,6 +54,8 @@ export function DependencyResolverProvider({ dependencyResolver, children }: Pro /** * Represents the dependency resolver scope context provider props. + * + * @see {@link DependencyResolverScope} */ export interface IDependencyResolverScopeProps { /** @@ -47,6 +69,10 @@ const emptyDeps: readonly any[] = []; /** * Configures a dependency resolver scope in the context of child components. + * + * @see {@link IDependencyResolver} + * @see {@link IDependencyContainer} + * @see {@link useDependency} */ export function DependencyResolverScope({ deps, children }: PropsWithChildren): JSX.Element { const normalizedDeps = deps === null || deps === undefined || !Array.isArray(deps) || deps.length === 0 diff --git a/src/dependencies/IDependencyContainer.ts b/src/dependencies/IDependencyContainer.ts index afe95f6..c3b7abb 100644 --- a/src/dependencies/IDependencyContainer.ts +++ b/src/dependencies/IDependencyContainer.ts @@ -1,12 +1,31 @@ -import type { IDependencyResolver, BasicDependency, SimpleDependency, DependencyToken } from "./IDependencyResolver"; +import type { IDependencyResolver, BasicDependency, SimpleDependency, ComplexDependency, DependencyToken, ResolvableSimpleDependency } from "./IDependencyResolver"; +import type { useDependency } from './UseDependency'; /** * Represents a configurable dependency. + * + * @template T The configurable dependency type. + * + * @see {@link IDependencyResolver} + * @see {@link IDependencyContainer} + * @see {@link BasicDependency} + * @see {@link SimpleDependency} + * @see {@link ComplexDependency} + * @see {@link DependencyToken} + * @see {@link useDependency} */ export type ConfigurableDependency = BasicDependency | SimpleDependency; /** * Represents a callback for initializing dependencies. + * + * @template T The dependency type that is resolved. + * + * @see {@link IDependencyResolver} + * @see {@link IDependencyContainer} + * @see {@link ResolvableSimpleDependency} + * @see {@link ConfigurableDependency} + * @see {@link useDependency} */ export type DependencyFactoryCallback = (dependecyResolver: IDependencyResolver) => T; @@ -48,6 +67,10 @@ export type DependencyFactoryCallback = (dependecyResolver: IDependencyResolv * const transient2 = dependencyContainer.resolve(MyThirdClass); * transient1 === transient2; // false * ``` + * @see {@link IDependencyResolver} + * @see {@link SimpleDependency} + * @see {@link ConfigurableDependency} + * @see {@link useDependency} */ export interface IDependencyContainer { /** diff --git a/src/dependencies/IDependencyResolver.ts b/src/dependencies/IDependencyResolver.ts index 302a4b1..c9d0a86 100644 --- a/src/dependencies/IDependencyResolver.ts +++ b/src/dependencies/IDependencyResolver.ts @@ -1,34 +1,46 @@ +import type { IDependencyContainer, ConfigurableDependency } from "./IDependencyContainer"; +import type { useDependency } from './UseDependency'; + /** * Represents a dependency resolver as an information expert responsible with initializing and providing requested dependencies. + * + * @see {@link IDependencyContainer} + * @see {@link ResolvableSimpleDependency} + * @see {@link ConfigurableDependency} + * @see {@link useDependency} */ export interface IDependencyResolver { /** * Creates a scoped dependency resolver. All scoped configured dependencies are resolved for each scope individually, * while singletons are unique from the scope that configured them downwards. + * * @returns Returns a scoped dependency resolver. */ createScope(): IDependencyResolver; /** * Resolves a dependency based on its configuration, if any. All unconfigured dependencies are transient. + * + * @template T The dependency type to resolve. + * * @param dependency The dependnecy to resolve. + * * @returns The resolved dependency. */ resolve(dependency: ResolvableSimpleDependency): T; /** * Resolves a complex dependency. All such dependencies are transient as they require * additional dependencies on the constructor. + * + * @template T The dependency type to resolve. + * @template TAdditional A tuple representing additional parameters required by the constructor. + * * @param dependency The complex dependnecy to resolve. * @param additionalDependencies Additional dependencies requested by the constructor besides the dependency resolver. + * * @returns The resolved dependency. */ resolve(dependency: ComplexDependency, additionalDependencies: TAdditional): T; - /** - * Resolves a dependency based on its configuration. All complex dependencies are transient, all unconfigured dependencies are transient. - * @param dependency The dependency to resolve. - * @param additionalDependencies Additional dependencies requested by the constructor besides the dependency resolver. - */ - resolve(dependency: ResolvableSimpleDependency | ComplexDependency, additionalDependencies: TAdditional): T; } /** @@ -38,12 +50,30 @@ export interface IDependencyResolver { * Resolvable dependencies provide an option where a dependency is resolved, but if there is an edge case where * said dependency was already resolved in a different way, it is provided through the same call allowing for * different use cases. + * + * @template T The resolvable dependency type. + * + * @see {@link IDependencyResolver} + * @see {@link IDependencyContainer} + * @see {@link BasicDependency} + * @see {@link SimpleDependency} + * @see {@link ComplexDependency} + * @see {@link DependencyToken} + * @see {@link useDependency} */ export type ResolvableSimpleDependency = Exclude | DependencyToken | BasicDependency | SimpleDependency; /** * Represents a basic dependency where the constructor does not require a resolver or any other dependencies * to create an instance. + * + * @template T The basic dependency type. + * + * @see {@link IDependencyResolver} + * @see {@link IDependencyContainer} + * @see {@link ResolvableSimpleDependency} + * @see {@link ConfigurableDependency} + * @see {@link useDependency} */ export type BasicDependency = { new(): T; @@ -51,6 +81,14 @@ export type BasicDependency = { /** * Represents a simple dependnecy where any additional dependencies are resolved through the provided dependnecy resolver. + * + * @template T The simple dependency type. + * + * @see {@link IDependencyResolver} + * @see {@link IDependencyContainer} + * @see {@link ResolvableSimpleDependency} + * @see {@link ConfigurableDependency} + * @see {@link useDependency} */ export type SimpleDependency = { new(dependencyResolver: IDependencyResolver): T; @@ -61,6 +99,15 @@ export type SimpleDependency = { * as well as providing them as constructor parameters. * * This is a more complex case where some parameters are page or component specific, such as the entity ID that is loaded. + * + * @template T The complex dependency type. + * @template TAdditional A tuple representing additional parameters required by the constructor. + * + * @see {@link IDependencyResolver} + * @see {@link IDependencyContainer} + * @see {@link ResolvableSimpleDependency} + * @see {@link ConfigurableDependency} + * @see {@link useDependency} */ export type ComplexDependency = { new(dependencyResolver: IDependencyResolver, ...additionalDependencies: TAdditional): T; @@ -74,6 +121,12 @@ export type ComplexDependency = { * an implementation. * * @template T The type that is associated with the dependency token. + * + * @see {@link IDependencyResolver} + * @see {@link IDependencyContainer} + * @see {@link ResolvableSimpleDependency} + * @see {@link ConfigurableDependency} + * @see {@link useDependency} */ export class DependencyToken { /** diff --git a/src/dependencies/UseDependency.ts b/src/dependencies/UseDependency.ts index fdc6fd2..67b6a50 100644 --- a/src/dependencies/UseDependency.ts +++ b/src/dependencies/UseDependency.ts @@ -1,6 +1,8 @@ -import type { ResolvableSimpleDependency, ComplexDependency } from "./IDependencyResolver"; +import type { IDependencyResolver, ResolvableSimpleDependency, ComplexDependency } from "./IDependencyResolver"; +import type { IDependencyContainer } from './IDependencyContainer'; +import type { useViewModelDependency } from './UseViewModelDependency'; import { useMemo, useRef } from "react"; -import { useDependencyResolver } from "./DependencyResolverContext"; +import { useDependencyResolver, type DependencyResolverProvider, type DependencyResolverScope } from "./DependencyResolverContext"; const emptyAdditionalDependencies: readonly unknown[] = []; @@ -12,6 +14,14 @@ const emptyAdditionalDependencies: readonly unknown[] = []; * @param dependency The dependency to resolve. * * @returns Returns the resolved dependency. + * + * @see {@link IDependencyResolver} + * @see {@link IDependencyContainer} + * @see {@link ResolvableSimpleDependency} + * @see {@link useDependencyResolver} + * @see {@link useViewModelDependency} + * @see {@link DependencyResolverProvider} + * @see {@link DependencyResolverScope} */ export function useDependency(dependency: ResolvableSimpleDependency): T; @@ -25,6 +35,14 @@ export function useDependency(dependency: ResolvableSimpleDependency): T; * @param additionalDependencies Additional constructor arguments which also act as dependencies, if one of them changes the dependency will be reinitialized. * * @returns Returns the resolved dependency. + * + * @see {@link IDependencyResolver} + * @see {@link IDependencyContainer} + * @see {@link ResolvableSimpleDependency} + * @see {@link useDependencyResolver} + * @see {@link useViewModelDependency} + * @see {@link DependencyResolverProvider} + * @see {@link DependencyResolverScope} */ export function useDependency(dependency: ComplexDependency, additionalDependencies: TAdditional): T; @@ -41,7 +59,7 @@ export function useDependency(dependency: const { current: cachedAdditionalDependencies } = cachedAdditionalDependenciesRef; const instance = useMemo( - () => dependecyResolver.resolve(dependency, cachedAdditionalDependencies), + () => dependecyResolver.resolve(dependency as ComplexDependency, cachedAdditionalDependencies), [dependecyResolver, dependency, cachedAdditionalDependencies] ); diff --git a/src/dependencies/UseViewModelDependency.ts b/src/dependencies/UseViewModelDependency.ts index 91b1e50..5ab31b1 100644 --- a/src/dependencies/UseViewModelDependency.ts +++ b/src/dependencies/UseViewModelDependency.ts @@ -1,5 +1,6 @@ import type { INotifyPropertiesChanged } from "../viewModels"; -import type { ResolvableSimpleDependency, ComplexDependency } from "./IDependencyResolver"; +import type { IDependencyResolver, ResolvableSimpleDependency, ComplexDependency } from "./IDependencyResolver"; +import type { IDependencyContainer, ConfigurableDependency } from './IDependencyContainer' import { useViewModel } from "../hooks"; import { useDependency } from "./UseDependency"; @@ -12,12 +13,19 @@ import { useDependency } from "./UseDependency"; * const viewModel = useDependency(viewModelDependency); * useViewModel(viewModel); * ``` - * + * * @template TViewModel The view model type to resolve. * * @param viewModelDependency The view model dependency to resolve. * - * @returns Returns the resolved view model which is also watched for changes. + * @returns Returns the resolved view model which is also watched for changes. + * + * @see {@link IDependencyResolver} + * @see {@link IDependencyContainer} + * @see {@link ResolvableSimpleDependency} + * @see {@link ConfigurableDependency} + * @see {@link useDependency} + * @see {@link useViewModel} */ export function useViewModelDependency(viewModelDependency: ResolvableSimpleDependency): TViewModel; @@ -30,7 +38,7 @@ export function useViewModelDependency(viewModelDependency: ComplexDependency, additionalDependencies: TAdditional): TViewModel; diff --git a/src/forms/IConfigurableFormCollection.ts b/src/forms/IConfigurableFormCollection.ts index efa7ea0..d3fa031 100644 --- a/src/forms/IConfigurableFormCollection.ts +++ b/src/forms/IConfigurableFormCollection.ts @@ -1,6 +1,11 @@ import type { Form } from './Form'; -/** Represents a callback used to configure an individual form section within a collection. */ +/** + * Represents a callback used to configure an individual form section within a collection. + * + * @template TSection The form section type to configure. + * @template TValidationError The concrete type for representing validaiton errors (strings, enums, numbers etc.). + */ export type FormSetupCallback, TValidationError = string> = (section: TSection) => void; /** diff --git a/src/index.ts b/src/index.ts index 0b25600..b95e20a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -112,6 +112,7 @@ export { DependencyContainer, type IDependencyResolverProviderProps, DependencyResolverProvider, + type IDependencyResolverScopeProps, DependencyResolverScope, useDependencyResolver, useDependency,