@depup/typedoc 0.28.17-depup.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +34 -0
- package/bin/package.json +3 -0
- package/bin/typedoc +24 -0
- package/changes.json +22 -0
- package/dist/browser-locales/de.d.ts +2 -0
- package/dist/browser-locales/de.js +62 -0
- package/dist/browser-locales/en.d.ts +2 -0
- package/dist/browser-locales/en.js +62 -0
- package/dist/browser-locales/ja.d.ts +2 -0
- package/dist/browser-locales/ja.js +62 -0
- package/dist/browser-locales/ko.d.ts +2 -0
- package/dist/browser-locales/ko.js +62 -0
- package/dist/browser-locales/zh.d.ts +2 -0
- package/dist/browser-locales/zh.js +62 -0
- package/dist/browser-utils.d.ts +3 -0
- package/dist/browser-utils.js +3 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.js +46 -0
- package/dist/lib/application-events.d.ts +5 -0
- package/dist/lib/application-events.js +5 -0
- package/dist/lib/application.d.ts +195 -0
- package/dist/lib/application.js +715 -0
- package/dist/lib/cli.d.ts +1 -0
- package/dist/lib/cli.js +111 -0
- package/dist/lib/converter/comments/blockLexer.d.ts +4 -0
- package/dist/lib/converter/comments/blockLexer.js +391 -0
- package/dist/lib/converter/comments/declarationReferenceResolver.d.ts +3 -0
- package/dist/lib/converter/comments/declarationReferenceResolver.js +218 -0
- package/dist/lib/converter/comments/discovery.d.ts +14 -0
- package/dist/lib/converter/comments/discovery.js +563 -0
- package/dist/lib/converter/comments/index.d.ts +37 -0
- package/dist/lib/converter/comments/index.js +241 -0
- package/dist/lib/converter/comments/lexer.d.ts +17 -0
- package/dist/lib/converter/comments/lexer.js +10 -0
- package/dist/lib/converter/comments/lineLexer.d.ts +3 -0
- package/dist/lib/converter/comments/lineLexer.js +279 -0
- package/dist/lib/converter/comments/linkResolver.d.ts +20 -0
- package/dist/lib/converter/comments/linkResolver.js +186 -0
- package/dist/lib/converter/comments/parser.d.ts +18 -0
- package/dist/lib/converter/comments/parser.js +538 -0
- package/dist/lib/converter/comments/rawLexer.d.ts +8 -0
- package/dist/lib/converter/comments/rawLexer.js +218 -0
- package/dist/lib/converter/comments/tagName.d.ts +8 -0
- package/dist/lib/converter/comments/tagName.js +58 -0
- package/dist/lib/converter/comments/textParser.d.ts +33 -0
- package/dist/lib/converter/comments/textParser.js +372 -0
- package/dist/lib/converter/components.d.ts +4 -0
- package/dist/lib/converter/components.js +3 -0
- package/dist/lib/converter/context.d.ts +101 -0
- package/dist/lib/converter/context.js +311 -0
- package/dist/lib/converter/convert-expression.d.ts +9 -0
- package/dist/lib/converter/convert-expression.js +58 -0
- package/dist/lib/converter/converter-events.d.ts +13 -0
- package/dist/lib/converter/converter-events.js +13 -0
- package/dist/lib/converter/converter.d.ts +238 -0
- package/dist/lib/converter/converter.js +705 -0
- package/dist/lib/converter/factories/index-signature.d.ts +3 -0
- package/dist/lib/converter/factories/index-signature.js +50 -0
- package/dist/lib/converter/factories/signature.d.ts +14 -0
- package/dist/lib/converter/factories/signature.js +353 -0
- package/dist/lib/converter/factories/symbol-id.d.ts +3 -0
- package/dist/lib/converter/factories/symbol-id.js +47 -0
- package/dist/lib/converter/index.d.ts +5 -0
- package/dist/lib/converter/index.js +3 -0
- package/dist/lib/converter/jsdoc.d.ts +4 -0
- package/dist/lib/converter/jsdoc.js +135 -0
- package/dist/lib/converter/plugins/CategoryPlugin.d.ts +48 -0
- package/dist/lib/converter/plugins/CategoryPlugin.js +278 -0
- package/dist/lib/converter/plugins/CommentPlugin.d.ts +128 -0
- package/dist/lib/converter/plugins/CommentPlugin.js +770 -0
- package/dist/lib/converter/plugins/GroupPlugin.d.ts +48 -0
- package/dist/lib/converter/plugins/GroupPlugin.js +281 -0
- package/dist/lib/converter/plugins/ImplementsPlugin.d.ts +42 -0
- package/dist/lib/converter/plugins/ImplementsPlugin.js +438 -0
- package/dist/lib/converter/plugins/IncludePlugin.d.ts +14 -0
- package/dist/lib/converter/plugins/IncludePlugin.js +254 -0
- package/dist/lib/converter/plugins/InheritDocPlugin.d.ts +32 -0
- package/dist/lib/converter/plugins/InheritDocPlugin.js +220 -0
- package/dist/lib/converter/plugins/LinkResolverPlugin.d.ts +13 -0
- package/dist/lib/converter/plugins/LinkResolverPlugin.js +88 -0
- package/dist/lib/converter/plugins/MergeModuleWithPlugin.d.ts +12 -0
- package/dist/lib/converter/plugins/MergeModuleWithPlugin.js +50 -0
- package/dist/lib/converter/plugins/PackagePlugin.d.ts +31 -0
- package/dist/lib/converter/plugins/PackagePlugin.js +188 -0
- package/dist/lib/converter/plugins/SourcePlugin.d.ts +36 -0
- package/dist/lib/converter/plugins/SourcePlugin.js +215 -0
- package/dist/lib/converter/plugins/TypePlugin.d.ts +16 -0
- package/dist/lib/converter/plugins/TypePlugin.js +108 -0
- package/dist/lib/converter/plugins/index.d.ts +10 -0
- package/dist/lib/converter/plugins/index.js +10 -0
- package/dist/lib/converter/symbols.d.ts +3 -0
- package/dist/lib/converter/symbols.js +861 -0
- package/dist/lib/converter/types.d.ts +10 -0
- package/dist/lib/converter/types.js +833 -0
- package/dist/lib/converter/utils/nodes.d.ts +7 -0
- package/dist/lib/converter/utils/nodes.js +26 -0
- package/dist/lib/converter/utils/reflections.d.ts +2 -0
- package/dist/lib/converter/utils/reflections.js +17 -0
- package/dist/lib/converter/utils/repository.d.ts +96 -0
- package/dist/lib/converter/utils/repository.js +295 -0
- package/dist/lib/converter/utils/symbols.d.ts +2 -0
- package/dist/lib/converter/utils/symbols.js +12 -0
- package/dist/lib/debug/index.d.ts +2 -0
- package/dist/lib/debug/index.js +2 -0
- package/dist/lib/debug/reflectionLifetimes.d.ts +3 -0
- package/dist/lib/debug/reflectionLifetimes.js +27 -0
- package/dist/lib/debug/rendererUrls.d.ts +6 -0
- package/dist/lib/debug/rendererUrls.js +68 -0
- package/dist/lib/internationalization/index.d.ts +7 -0
- package/dist/lib/internationalization/index.js +7 -0
- package/dist/lib/internationalization/internationalization.d.ts +65 -0
- package/dist/lib/internationalization/internationalization.js +64 -0
- package/dist/lib/internationalization/locale-utils.cjs +8 -0
- package/dist/lib/internationalization/locale-utils.d.cts +8 -0
- package/dist/lib/internationalization/locales/de.cjs +401 -0
- package/dist/lib/internationalization/locales/de.d.cts +368 -0
- package/dist/lib/internationalization/locales/en.cjs +411 -0
- package/dist/lib/internationalization/locales/en.d.cts +380 -0
- package/dist/lib/internationalization/locales/ja.cjs +320 -0
- package/dist/lib/internationalization/locales/ja.d.cts +307 -0
- package/dist/lib/internationalization/locales/ko.cjs +233 -0
- package/dist/lib/internationalization/locales/ko.d.cts +221 -0
- package/dist/lib/internationalization/locales/zh.cjs +488 -0
- package/dist/lib/internationalization/locales/zh.d.cts +452 -0
- package/dist/lib/internationalization/translatable.d.ts +21 -0
- package/dist/lib/internationalization/translatable.js +8 -0
- package/dist/lib/models/Comment.d.ts +241 -0
- package/dist/lib/models/Comment.js +534 -0
- package/dist/lib/models/ContainerReflection.d.ts +56 -0
- package/dist/lib/models/ContainerReflection.js +159 -0
- package/dist/lib/models/DeclarationReflection.d.ts +149 -0
- package/dist/lib/models/DeclarationReflection.js +287 -0
- package/dist/lib/models/DocumentReflection.d.ts +32 -0
- package/dist/lib/models/DocumentReflection.js +66 -0
- package/dist/lib/models/FileRegistry.d.ts +46 -0
- package/dist/lib/models/FileRegistry.js +133 -0
- package/dist/lib/models/ParameterReflection.d.ts +21 -0
- package/dist/lib/models/ParameterReflection.js +39 -0
- package/dist/lib/models/ProjectReflection.d.ts +112 -0
- package/dist/lib/models/ProjectReflection.js +417 -0
- package/dist/lib/models/ReferenceReflection.d.ts +49 -0
- package/dist/lib/models/ReferenceReflection.js +85 -0
- package/dist/lib/models/Reflection.d.ts +229 -0
- package/dist/lib/models/Reflection.js +495 -0
- package/dist/lib/models/ReflectionCategory.d.ts +31 -0
- package/dist/lib/models/ReflectionCategory.js +56 -0
- package/dist/lib/models/ReflectionGroup.d.ts +38 -0
- package/dist/lib/models/ReflectionGroup.js +72 -0
- package/dist/lib/models/ReflectionSymbolId.d.ts +63 -0
- package/dist/lib/models/ReflectionSymbolId.js +85 -0
- package/dist/lib/models/SignatureReflection.d.ts +50 -0
- package/dist/lib/models/SignatureReflection.js +96 -0
- package/dist/lib/models/SourceReference.d.ts +33 -0
- package/dist/lib/models/SourceReference.js +50 -0
- package/dist/lib/models/TypeParameterReflection.d.ts +30 -0
- package/dist/lib/models/TypeParameterReflection.js +45 -0
- package/dist/lib/models/index.d.ts +19 -0
- package/dist/lib/models/index.js +19 -0
- package/dist/lib/models/kind.d.ts +84 -0
- package/dist/lib/models/kind.js +231 -0
- package/dist/lib/models/types.d.ts +553 -0
- package/dist/lib/models/types.js +1296 -0
- package/dist/lib/models/utils.d.ts +1 -0
- package/dist/lib/models/utils.js +26 -0
- package/dist/lib/models/variant.d.ts +21 -0
- package/dist/lib/models/variant.js +1 -0
- package/dist/lib/output/components.d.ts +53 -0
- package/dist/lib/output/components.js +133 -0
- package/dist/lib/output/events.d.ts +175 -0
- package/dist/lib/output/events.js +195 -0
- package/dist/lib/output/formatter.d.ts +88 -0
- package/dist/lib/output/formatter.js +660 -0
- package/dist/lib/output/index.d.ts +9 -0
- package/dist/lib/output/index.js +7 -0
- package/dist/lib/output/output.d.ts +14 -0
- package/dist/lib/output/output.js +92 -0
- package/dist/lib/output/plugins/AssetsPlugin.d.ts +20 -0
- package/dist/lib/output/plugins/AssetsPlugin.js +160 -0
- package/dist/lib/output/plugins/HierarchyPlugin.d.ts +7 -0
- package/dist/lib/output/plugins/HierarchyPlugin.js +65 -0
- package/dist/lib/output/plugins/IconsPlugin.d.ts +12 -0
- package/dist/lib/output/plugins/IconsPlugin.js +54 -0
- package/dist/lib/output/plugins/JavascriptIndexPlugin.d.ts +22 -0
- package/dist/lib/output/plugins/JavascriptIndexPlugin.js +222 -0
- package/dist/lib/output/plugins/NavigationPlugin.d.ts +7 -0
- package/dist/lib/output/plugins/NavigationPlugin.js +23 -0
- package/dist/lib/output/plugins/SitemapPlugin.d.ts +8 -0
- package/dist/lib/output/plugins/SitemapPlugin.js +82 -0
- package/dist/lib/output/plugins/index.d.ts +7 -0
- package/dist/lib/output/plugins/index.js +7 -0
- package/dist/lib/output/renderer.d.ts +227 -0
- package/dist/lib/output/renderer.js +387 -0
- package/dist/lib/output/router.d.ts +187 -0
- package/dist/lib/output/router.js +520 -0
- package/dist/lib/output/theme.d.ts +22 -0
- package/dist/lib/output/theme.js +17 -0
- package/dist/lib/output/themes/MarkedPlugin.d.ts +62 -0
- package/dist/lib/output/themes/MarkedPlugin.js +461 -0
- package/dist/lib/output/themes/default/DefaultTheme.d.ts +72 -0
- package/dist/lib/output/themes/default/DefaultTheme.js +367 -0
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +105 -0
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +151 -0
- package/dist/lib/output/themes/default/Slugger.d.ts +13 -0
- package/dist/lib/output/themes/default/Slugger.js +60 -0
- package/dist/lib/output/themes/default/layouts/default.d.ts +6 -0
- package/dist/lib/output/themes/default/layouts/default.js +89 -0
- package/dist/lib/output/themes/default/partials/anchor-icon.d.ts +5 -0
- package/dist/lib/output/themes/default/partials/anchor-icon.js +9 -0
- package/dist/lib/output/themes/default/partials/breadcrumb.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/breadcrumb.js +11 -0
- package/dist/lib/output/themes/default/partials/comment.d.ts +8 -0
- package/dist/lib/output/themes/default/partials/comment.js +80 -0
- package/dist/lib/output/themes/default/partials/footer.d.ts +3 -0
- package/dist/lib/output/themes/default/partials/footer.js +37 -0
- package/dist/lib/output/themes/default/partials/header.d.ts +5 -0
- package/dist/lib/output/themes/default/partials/header.js +39 -0
- package/dist/lib/output/themes/default/partials/hierarchy.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/hierarchy.js +32 -0
- package/dist/lib/output/themes/default/partials/icon.d.ts +20 -0
- package/dist/lib/output/themes/default/partials/icon.js +101 -0
- package/dist/lib/output/themes/default/partials/index.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/index.js +24 -0
- package/dist/lib/output/themes/default/partials/member.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/member.declaration.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/member.declaration.js +35 -0
- package/dist/lib/output/themes/default/partials/member.getterSetter.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/member.getterSetter.js +12 -0
- package/dist/lib/output/themes/default/partials/member.js +36 -0
- package/dist/lib/output/themes/default/partials/member.signature.body.d.ts +6 -0
- package/dist/lib/output/themes/default/partials/member.signature.body.js +33 -0
- package/dist/lib/output/themes/default/partials/member.signature.title.d.ts +5 -0
- package/dist/lib/output/themes/default/partials/member.signature.title.js +9 -0
- package/dist/lib/output/themes/default/partials/member.signatures.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/member.signatures.js +9 -0
- package/dist/lib/output/themes/default/partials/member.sources.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/member.sources.js +55 -0
- package/dist/lib/output/themes/default/partials/members.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/members.js +17 -0
- package/dist/lib/output/themes/default/partials/moduleReflection.d.ts +5 -0
- package/dist/lib/output/themes/default/partials/moduleReflection.js +68 -0
- package/dist/lib/output/themes/default/partials/navigation.d.ts +10 -0
- package/dist/lib/output/themes/default/partials/navigation.js +144 -0
- package/dist/lib/output/themes/default/partials/reflectionPreview.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/reflectionPreview.js +26 -0
- package/dist/lib/output/themes/default/partials/toolbar.d.ts +5 -0
- package/dist/lib/output/themes/default/partials/toolbar.js +13 -0
- package/dist/lib/output/themes/default/partials/type.d.ts +5 -0
- package/dist/lib/output/themes/default/partials/type.js +9 -0
- package/dist/lib/output/themes/default/partials/typeAndParent.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/typeAndParent.js +28 -0
- package/dist/lib/output/themes/default/partials/typeDetails.d.ts +8 -0
- package/dist/lib/output/themes/default/partials/typeDetails.js +284 -0
- package/dist/lib/output/themes/default/partials/typeParameters.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/typeParameters.js +26 -0
- package/dist/lib/output/themes/default/templates/document.d.ts +5 -0
- package/dist/lib/output/themes/default/templates/document.js +3 -0
- package/dist/lib/output/themes/default/templates/hierarchy.d.ts +5 -0
- package/dist/lib/output/themes/default/templates/hierarchy.js +31 -0
- package/dist/lib/output/themes/default/templates/index.d.ts +5 -0
- package/dist/lib/output/themes/default/templates/index.js +3 -0
- package/dist/lib/output/themes/default/templates/reflection.d.ts +5 -0
- package/dist/lib/output/themes/default/templates/reflection.js +53 -0
- package/dist/lib/output/themes/lib.d.ts +44 -0
- package/dist/lib/output/themes/lib.js +218 -0
- package/dist/lib/serialization/components.d.ts +22 -0
- package/dist/lib/serialization/components.js +1 -0
- package/dist/lib/serialization/deserializer.d.ts +70 -0
- package/dist/lib/serialization/deserializer.js +235 -0
- package/dist/lib/serialization/events.d.ts +17 -0
- package/dist/lib/serialization/events.js +18 -0
- package/dist/lib/serialization/index.d.ts +5 -0
- package/dist/lib/serialization/index.js +4 -0
- package/dist/lib/serialization/schema.d.ts +283 -0
- package/dist/lib/serialization/schema.js +32 -0
- package/dist/lib/serialization/serializer.d.ts +52 -0
- package/dist/lib/serialization/serializer.js +65 -0
- package/dist/lib/utils/ValidatingFileRegistry.d.ts +12 -0
- package/dist/lib/utils/ValidatingFileRegistry.js +52 -0
- package/dist/lib/utils/component.d.ts +38 -0
- package/dist/lib/utils/component.js +41 -0
- package/dist/lib/utils/compress.d.ts +7 -0
- package/dist/lib/utils/compress.js +13 -0
- package/dist/lib/utils/declaration-maps.d.ts +3 -0
- package/dist/lib/utils/declaration-maps.js +51 -0
- package/dist/lib/utils/entry-point.d.ts +50 -0
- package/dist/lib/utils/entry-point.js +330 -0
- package/dist/lib/utils/fs.d.ts +65 -0
- package/dist/lib/utils/fs.js +372 -0
- package/dist/lib/utils/general.d.ts +4 -0
- package/dist/lib/utils/general.js +25 -0
- package/dist/lib/utils/highlighter.d.ts +9 -0
- package/dist/lib/utils/highlighter.js +150 -0
- package/dist/lib/utils/html-entities.d.ts +8926 -0
- package/dist/lib/utils/html-entities.js +2329 -0
- package/dist/lib/utils/html.d.ts +67 -0
- package/dist/lib/utils/html.js +635 -0
- package/dist/lib/utils/index.d.ts +17 -0
- package/dist/lib/utils/index.js +15 -0
- package/dist/lib/utils/loggers.d.ts +10 -0
- package/dist/lib/utils/loggers.js +71 -0
- package/dist/lib/utils/options/declaration.d.ts +514 -0
- package/dist/lib/utils/options/declaration.js +443 -0
- package/dist/lib/utils/options/defaults.d.ts +20 -0
- package/dist/lib/utils/options/defaults.js +104 -0
- package/dist/lib/utils/options/help.d.ts +7 -0
- package/dist/lib/utils/options/help.js +63 -0
- package/dist/lib/utils/options/index.d.ts +6 -0
- package/dist/lib/utils/options/index.js +4 -0
- package/dist/lib/utils/options/options.d.ts +199 -0
- package/dist/lib/utils/options/options.js +273 -0
- package/dist/lib/utils/options/readers/arguments.d.ts +15 -0
- package/dist/lib/utils/options/readers/arguments.js +109 -0
- package/dist/lib/utils/options/readers/index.d.ts +4 -0
- package/dist/lib/utils/options/readers/index.js +4 -0
- package/dist/lib/utils/options/readers/package-json.d.ts +9 -0
- package/dist/lib/utils/options/readers/package-json.js +40 -0
- package/dist/lib/utils/options/readers/tsconfig.d.ts +14 -0
- package/dist/lib/utils/options/readers/tsconfig.js +172 -0
- package/dist/lib/utils/options/readers/typedoc.d.ts +33 -0
- package/dist/lib/utils/options/readers/typedoc.js +136 -0
- package/dist/lib/utils/options/sources/index.d.ts +1 -0
- package/dist/lib/utils/options/sources/index.js +1 -0
- package/dist/lib/utils/options/sources/typedoc.d.ts +2 -0
- package/dist/lib/utils/options/sources/typedoc.js +876 -0
- package/dist/lib/utils/options/tsdoc-defaults.d.ts +6 -0
- package/dist/lib/utils/options/tsdoc-defaults.js +94 -0
- package/dist/lib/utils/package-manifest.d.ts +11 -0
- package/dist/lib/utils/package-manifest.js +84 -0
- package/dist/lib/utils/paths.d.ts +27 -0
- package/dist/lib/utils/paths.js +127 -0
- package/dist/lib/utils/perf.d.ts +6 -0
- package/dist/lib/utils/perf.js +86 -0
- package/dist/lib/utils/plugins.d.ts +3 -0
- package/dist/lib/utils/plugins.js +61 -0
- package/dist/lib/utils/reflections.d.ts +5 -0
- package/dist/lib/utils/reflections.js +64 -0
- package/dist/lib/utils/sort.d.ts +11 -0
- package/dist/lib/utils/sort.js +153 -0
- package/dist/lib/utils/tsconfig.d.ts +5 -0
- package/dist/lib/utils/tsconfig.js +60 -0
- package/dist/lib/utils/tsutils.d.ts +3 -0
- package/dist/lib/utils/tsutils.js +23 -0
- package/dist/lib/utils-common/array.d.ts +57 -0
- package/dist/lib/utils-common/array.js +152 -0
- package/dist/lib/utils-common/declarationReference.d.ts +42 -0
- package/dist/lib/utils-common/declarationReference.js +341 -0
- package/dist/lib/utils-common/enum.d.ts +9 -0
- package/dist/lib/utils-common/enum.js +27 -0
- package/dist/lib/utils-common/events.d.ts +29 -0
- package/dist/lib/utils-common/events.js +49 -0
- package/dist/lib/utils-common/general.d.ts +40 -0
- package/dist/lib/utils-common/general.js +22 -0
- package/dist/lib/utils-common/hooks.d.ts +51 -0
- package/dist/lib/utils-common/hooks.js +90 -0
- package/dist/lib/utils-common/i18n.d.ts +18 -0
- package/dist/lib/utils-common/i18n.js +39 -0
- package/dist/lib/utils-common/index.d.ts +16 -0
- package/dist/lib/utils-common/index.js +17 -0
- package/dist/lib/utils-common/jsx.d.ts +53 -0
- package/dist/lib/utils-common/jsx.elements.d.ts +949 -0
- package/dist/lib/utils-common/jsx.elements.js +3 -0
- package/dist/lib/utils-common/jsx.js +187 -0
- package/dist/lib/utils-common/logger.d.ts +97 -0
- package/dist/lib/utils-common/logger.js +129 -0
- package/dist/lib/utils-common/map.d.ts +23 -0
- package/dist/lib/utils-common/map.js +63 -0
- package/dist/lib/utils-common/minimalSourceFile.d.ts +12 -0
- package/dist/lib/utils-common/minimalSourceFile.js +43 -0
- package/dist/lib/utils-common/path.d.ts +42 -0
- package/dist/lib/utils-common/path.js +130 -0
- package/dist/lib/utils-common/set.d.ts +3 -0
- package/dist/lib/utils-common/set.js +23 -0
- package/dist/lib/utils-common/string.d.ts +11 -0
- package/dist/lib/utils-common/string.js +84 -0
- package/dist/lib/utils-common/validation.d.ts +33 -0
- package/dist/lib/utils-common/validation.js +50 -0
- package/dist/lib/validation/documentation.d.ts +3 -0
- package/dist/lib/validation/documentation.js +91 -0
- package/dist/lib/validation/exports.d.ts +3 -0
- package/dist/lib/validation/exports.js +65 -0
- package/dist/lib/validation/links.d.ts +3 -0
- package/dist/lib/validation/links.js +78 -0
- package/dist/lib/validation/unusedMergeModuleWith.d.ts +3 -0
- package/dist/lib/validation/unusedMergeModuleWith.js +12 -0
- package/package.json +161 -0
- package/static/main.js +58 -0
- package/static/style.css +1633 -0
- package/tsdoc.json +247 -0
- package/typedoc-config.schema.json +941 -0
|
@@ -0,0 +1,1296 @@
|
|
|
1
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
+
var _, done = false;
|
|
7
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
+
var context = {};
|
|
9
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
+
if (kind === "accessor") {
|
|
14
|
+
if (result === void 0) continue;
|
|
15
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
+
}
|
|
20
|
+
else if (_ = accept(result)) {
|
|
21
|
+
if (kind === "field") initializers.unshift(_);
|
|
22
|
+
else descriptor[key] = _;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
+
done = true;
|
|
27
|
+
};
|
|
28
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
+
var useValue = arguments.length > 2;
|
|
30
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
+
}
|
|
33
|
+
return useValue ? value : void 0;
|
|
34
|
+
};
|
|
35
|
+
import { ReflectionSymbolId } from "./ReflectionSymbolId.js";
|
|
36
|
+
import { ReflectionKind } from "./kind.js";
|
|
37
|
+
import { Comment } from "./Comment.js";
|
|
38
|
+
import { i18n, joinArray, NonEnumerable } from "#utils";
|
|
39
|
+
/**
|
|
40
|
+
* Base class of all type definitions.
|
|
41
|
+
* @category Types
|
|
42
|
+
*/
|
|
43
|
+
export class Type {
|
|
44
|
+
/**
|
|
45
|
+
* Return a string representation of this type.
|
|
46
|
+
*/
|
|
47
|
+
toString() {
|
|
48
|
+
return this.stringify(TypeContext.none);
|
|
49
|
+
}
|
|
50
|
+
visit(visitor, ...args) {
|
|
51
|
+
return visitor[this.type]?.(this, ...args);
|
|
52
|
+
}
|
|
53
|
+
stringify(context) {
|
|
54
|
+
if (this.needsParenthesis(context)) {
|
|
55
|
+
return `(${this.getTypeString()})`;
|
|
56
|
+
}
|
|
57
|
+
return this.getTypeString();
|
|
58
|
+
}
|
|
59
|
+
// Nothing to do for the majority of types.
|
|
60
|
+
fromObject(_de, _obj) { }
|
|
61
|
+
/**
|
|
62
|
+
* Return the estimated size of the type if it was all printed on one line.
|
|
63
|
+
*/
|
|
64
|
+
estimatePrintWidth() {
|
|
65
|
+
return this.getTypeString().length;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
export function makeRecursiveVisitor(visitor) {
|
|
69
|
+
const recursiveVisitor = {
|
|
70
|
+
namedTupleMember(type) {
|
|
71
|
+
visitor.namedTupleMember?.(type);
|
|
72
|
+
type.element.visit(recursiveVisitor);
|
|
73
|
+
},
|
|
74
|
+
templateLiteral(type) {
|
|
75
|
+
visitor.templateLiteral?.(type);
|
|
76
|
+
for (const [h] of type.tail) {
|
|
77
|
+
h.visit(recursiveVisitor);
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
array(type) {
|
|
81
|
+
visitor.array?.(type);
|
|
82
|
+
type.elementType.visit(recursiveVisitor);
|
|
83
|
+
},
|
|
84
|
+
conditional(type) {
|
|
85
|
+
visitor.conditional?.(type);
|
|
86
|
+
type.checkType.visit(recursiveVisitor);
|
|
87
|
+
type.extendsType.visit(recursiveVisitor);
|
|
88
|
+
type.trueType.visit(recursiveVisitor);
|
|
89
|
+
type.falseType.visit(recursiveVisitor);
|
|
90
|
+
},
|
|
91
|
+
indexedAccess(type) {
|
|
92
|
+
visitor.indexedAccess?.(type);
|
|
93
|
+
type.indexType.visit(recursiveVisitor);
|
|
94
|
+
type.objectType.visit(recursiveVisitor);
|
|
95
|
+
},
|
|
96
|
+
inferred(type) {
|
|
97
|
+
visitor.inferred?.(type);
|
|
98
|
+
type.constraint?.visit(recursiveVisitor);
|
|
99
|
+
},
|
|
100
|
+
intersection(type) {
|
|
101
|
+
visitor.intersection?.(type);
|
|
102
|
+
type.types.forEach((t) => t.visit(recursiveVisitor));
|
|
103
|
+
},
|
|
104
|
+
intrinsic(type) {
|
|
105
|
+
visitor.intrinsic?.(type);
|
|
106
|
+
},
|
|
107
|
+
literal(type) {
|
|
108
|
+
visitor.literal?.(type);
|
|
109
|
+
},
|
|
110
|
+
mapped(type) {
|
|
111
|
+
visitor.mapped?.(type);
|
|
112
|
+
type.nameType?.visit(recursiveVisitor);
|
|
113
|
+
type.parameterType.visit(recursiveVisitor);
|
|
114
|
+
type.templateType.visit(recursiveVisitor);
|
|
115
|
+
},
|
|
116
|
+
optional(type) {
|
|
117
|
+
visitor.optional?.(type);
|
|
118
|
+
type.elementType.visit(recursiveVisitor);
|
|
119
|
+
},
|
|
120
|
+
predicate(type) {
|
|
121
|
+
visitor.predicate?.(type);
|
|
122
|
+
type.targetType?.visit(recursiveVisitor);
|
|
123
|
+
},
|
|
124
|
+
query(type) {
|
|
125
|
+
visitor.query?.(type);
|
|
126
|
+
type.queryType.visit(recursiveVisitor);
|
|
127
|
+
},
|
|
128
|
+
reference(type) {
|
|
129
|
+
visitor.reference?.(type);
|
|
130
|
+
type.typeArguments?.forEach((t) => t.visit(recursiveVisitor));
|
|
131
|
+
},
|
|
132
|
+
reflection(type) {
|
|
133
|
+
visitor.reflection?.(type);
|
|
134
|
+
// Future: This should maybe recurse too?
|
|
135
|
+
// See the validator in exports.ts for how to do it.
|
|
136
|
+
},
|
|
137
|
+
rest(type) {
|
|
138
|
+
visitor.rest?.(type);
|
|
139
|
+
type.elementType.visit(recursiveVisitor);
|
|
140
|
+
},
|
|
141
|
+
tuple(type) {
|
|
142
|
+
visitor.tuple?.(type);
|
|
143
|
+
type.elements.forEach((t) => t.visit(recursiveVisitor));
|
|
144
|
+
},
|
|
145
|
+
typeOperator(type) {
|
|
146
|
+
visitor.typeOperator?.(type);
|
|
147
|
+
type.target.visit(recursiveVisitor);
|
|
148
|
+
},
|
|
149
|
+
union(type) {
|
|
150
|
+
visitor.union?.(type);
|
|
151
|
+
type.types.forEach((t) => t.visit(recursiveVisitor));
|
|
152
|
+
},
|
|
153
|
+
unknown(type) {
|
|
154
|
+
visitor.unknown?.(type);
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
return recursiveVisitor;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Enumeration that can be used when traversing types to track the location of recursion.
|
|
161
|
+
* Used by TypeDoc internally to track when to output parenthesis when rendering.
|
|
162
|
+
* @enum
|
|
163
|
+
*/
|
|
164
|
+
export const TypeContext = {
|
|
165
|
+
none: "none",
|
|
166
|
+
templateLiteralElement: "templateLiteralElement", // `${here}`
|
|
167
|
+
arrayElement: "arrayElement", // here[]
|
|
168
|
+
indexedAccessElement: "indexedAccessElement", // {}[here]
|
|
169
|
+
conditionalCheck: "conditionalCheck", // here extends 1 ? 2 : 3
|
|
170
|
+
conditionalExtends: "conditionalExtends", // 1 extends here ? 2 : 3
|
|
171
|
+
conditionalTrue: "conditionalTrue", // 1 extends 2 ? here : 3
|
|
172
|
+
conditionalFalse: "conditionalFalse", // 1 extends 2 ? 3 : here
|
|
173
|
+
indexedIndex: "indexedIndex", // {}[here]
|
|
174
|
+
indexedObject: "indexedObject", // here[1]
|
|
175
|
+
inferredConstraint: "inferredConstraint", // 1 extends infer X extends here ? 1 : 2
|
|
176
|
+
intersectionElement: "intersectionElement", // here & 1
|
|
177
|
+
mappedName: "mappedName", // { [k in string as here]: 1 }
|
|
178
|
+
mappedParameter: "mappedParameter", // { [k in here]: 1 }
|
|
179
|
+
mappedTemplate: "mappedTemplate", // { [k in string]: here }
|
|
180
|
+
optionalElement: "optionalElement", // [here?]
|
|
181
|
+
predicateTarget: "predicateTarget", // (): X is here
|
|
182
|
+
queryTypeTarget: "queryTypeTarget", // typeof here, can only ever be a ReferenceType
|
|
183
|
+
typeOperatorTarget: "typeOperatorTarget", // keyof here
|
|
184
|
+
referenceTypeArgument: "referenceTypeArgument", // X<here>
|
|
185
|
+
restElement: "restElement", // [...here]
|
|
186
|
+
tupleElement: "tupleElement", // [here]
|
|
187
|
+
unionElement: "unionElement", // here | 1
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
* Represents an array type.
|
|
191
|
+
*
|
|
192
|
+
* ```ts
|
|
193
|
+
* let value: string[];
|
|
194
|
+
* ```
|
|
195
|
+
* @category Types
|
|
196
|
+
*/
|
|
197
|
+
export class ArrayType extends Type {
|
|
198
|
+
elementType;
|
|
199
|
+
type = "array";
|
|
200
|
+
/**
|
|
201
|
+
* @param elementType The type of the elements in the array.
|
|
202
|
+
*/
|
|
203
|
+
constructor(elementType) {
|
|
204
|
+
super();
|
|
205
|
+
this.elementType = elementType;
|
|
206
|
+
}
|
|
207
|
+
getTypeString() {
|
|
208
|
+
return this.elementType.stringify(TypeContext.arrayElement) + "[]";
|
|
209
|
+
}
|
|
210
|
+
needsParenthesis() {
|
|
211
|
+
return false;
|
|
212
|
+
}
|
|
213
|
+
toObject(serializer) {
|
|
214
|
+
return {
|
|
215
|
+
type: this.type,
|
|
216
|
+
elementType: serializer.toObject(this.elementType),
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Represents a conditional type.
|
|
222
|
+
*
|
|
223
|
+
* ```ts
|
|
224
|
+
* let value: Check extends Extends ? True : False;
|
|
225
|
+
* ```
|
|
226
|
+
* @category Types
|
|
227
|
+
*/
|
|
228
|
+
export class ConditionalType extends Type {
|
|
229
|
+
checkType;
|
|
230
|
+
extendsType;
|
|
231
|
+
trueType;
|
|
232
|
+
falseType;
|
|
233
|
+
type = "conditional";
|
|
234
|
+
constructor(checkType, extendsType, trueType, falseType) {
|
|
235
|
+
super();
|
|
236
|
+
this.checkType = checkType;
|
|
237
|
+
this.extendsType = extendsType;
|
|
238
|
+
this.trueType = trueType;
|
|
239
|
+
this.falseType = falseType;
|
|
240
|
+
}
|
|
241
|
+
getTypeString() {
|
|
242
|
+
return [
|
|
243
|
+
this.checkType.stringify(TypeContext.conditionalCheck),
|
|
244
|
+
"extends",
|
|
245
|
+
this.extendsType.stringify(TypeContext.conditionalExtends),
|
|
246
|
+
"?",
|
|
247
|
+
this.trueType.stringify(TypeContext.conditionalTrue),
|
|
248
|
+
":",
|
|
249
|
+
this.falseType.stringify(TypeContext.conditionalFalse),
|
|
250
|
+
].join(" ");
|
|
251
|
+
}
|
|
252
|
+
needsParenthesis(context) {
|
|
253
|
+
const map = {
|
|
254
|
+
none: false,
|
|
255
|
+
templateLiteralElement: false,
|
|
256
|
+
arrayElement: true,
|
|
257
|
+
indexedAccessElement: false,
|
|
258
|
+
conditionalCheck: true,
|
|
259
|
+
conditionalExtends: true,
|
|
260
|
+
conditionalTrue: false,
|
|
261
|
+
conditionalFalse: false,
|
|
262
|
+
indexedIndex: false,
|
|
263
|
+
indexedObject: true,
|
|
264
|
+
inferredConstraint: true,
|
|
265
|
+
intersectionElement: true,
|
|
266
|
+
mappedName: false,
|
|
267
|
+
mappedParameter: false,
|
|
268
|
+
mappedTemplate: false,
|
|
269
|
+
optionalElement: true,
|
|
270
|
+
predicateTarget: false,
|
|
271
|
+
queryTypeTarget: false,
|
|
272
|
+
typeOperatorTarget: true,
|
|
273
|
+
referenceTypeArgument: false,
|
|
274
|
+
restElement: true,
|
|
275
|
+
tupleElement: false,
|
|
276
|
+
unionElement: true,
|
|
277
|
+
};
|
|
278
|
+
return map[context];
|
|
279
|
+
}
|
|
280
|
+
toObject(serializer) {
|
|
281
|
+
return {
|
|
282
|
+
type: this.type,
|
|
283
|
+
checkType: serializer.toObject(this.checkType),
|
|
284
|
+
extendsType: serializer.toObject(this.extendsType),
|
|
285
|
+
trueType: serializer.toObject(this.trueType),
|
|
286
|
+
falseType: serializer.toObject(this.falseType),
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Represents an indexed access type.
|
|
292
|
+
* @category Types
|
|
293
|
+
*/
|
|
294
|
+
export class IndexedAccessType extends Type {
|
|
295
|
+
objectType;
|
|
296
|
+
indexType;
|
|
297
|
+
type = "indexedAccess";
|
|
298
|
+
constructor(objectType, indexType) {
|
|
299
|
+
super();
|
|
300
|
+
this.objectType = objectType;
|
|
301
|
+
this.indexType = indexType;
|
|
302
|
+
}
|
|
303
|
+
getTypeString() {
|
|
304
|
+
return [
|
|
305
|
+
this.objectType.stringify(TypeContext.indexedObject),
|
|
306
|
+
"[",
|
|
307
|
+
this.indexType.stringify(TypeContext.indexedIndex),
|
|
308
|
+
"]",
|
|
309
|
+
].join("");
|
|
310
|
+
}
|
|
311
|
+
needsParenthesis() {
|
|
312
|
+
return false;
|
|
313
|
+
}
|
|
314
|
+
toObject(serializer) {
|
|
315
|
+
return {
|
|
316
|
+
type: this.type,
|
|
317
|
+
indexType: serializer.toObject(this.indexType),
|
|
318
|
+
objectType: serializer.toObject(this.objectType),
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Represents an inferred type, U in the example below.
|
|
324
|
+
*
|
|
325
|
+
* ```ts
|
|
326
|
+
* type Z = Promise<string> extends Promise<infer U> : never
|
|
327
|
+
* ```
|
|
328
|
+
* @category Types
|
|
329
|
+
*/
|
|
330
|
+
export class InferredType extends Type {
|
|
331
|
+
name;
|
|
332
|
+
constraint;
|
|
333
|
+
type = "inferred";
|
|
334
|
+
constructor(name, constraint) {
|
|
335
|
+
super();
|
|
336
|
+
this.name = name;
|
|
337
|
+
this.constraint = constraint;
|
|
338
|
+
}
|
|
339
|
+
getTypeString() {
|
|
340
|
+
if (this.constraint) {
|
|
341
|
+
return `infer ${this.name} extends ${this.constraint.stringify(TypeContext.inferredConstraint)}`;
|
|
342
|
+
}
|
|
343
|
+
return `infer ${this.name}`;
|
|
344
|
+
}
|
|
345
|
+
needsParenthesis(context) {
|
|
346
|
+
const map = {
|
|
347
|
+
none: false,
|
|
348
|
+
templateLiteralElement: false,
|
|
349
|
+
arrayElement: true,
|
|
350
|
+
indexedAccessElement: false,
|
|
351
|
+
conditionalCheck: false,
|
|
352
|
+
conditionalExtends: false,
|
|
353
|
+
conditionalTrue: false,
|
|
354
|
+
conditionalFalse: false,
|
|
355
|
+
indexedIndex: false,
|
|
356
|
+
indexedObject: true,
|
|
357
|
+
inferredConstraint: false,
|
|
358
|
+
intersectionElement: false,
|
|
359
|
+
mappedName: false,
|
|
360
|
+
mappedParameter: false,
|
|
361
|
+
mappedTemplate: false,
|
|
362
|
+
optionalElement: true,
|
|
363
|
+
predicateTarget: false,
|
|
364
|
+
queryTypeTarget: false,
|
|
365
|
+
typeOperatorTarget: false,
|
|
366
|
+
referenceTypeArgument: false,
|
|
367
|
+
restElement: true,
|
|
368
|
+
tupleElement: false,
|
|
369
|
+
unionElement: false,
|
|
370
|
+
};
|
|
371
|
+
return map[context];
|
|
372
|
+
}
|
|
373
|
+
toObject(serializer) {
|
|
374
|
+
return {
|
|
375
|
+
type: this.type,
|
|
376
|
+
name: this.name,
|
|
377
|
+
constraint: serializer.toObject(this.constraint),
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Represents an intersection type.
|
|
383
|
+
*
|
|
384
|
+
* ```ts
|
|
385
|
+
* let value: A & B;
|
|
386
|
+
* ```
|
|
387
|
+
* @category Types
|
|
388
|
+
*/
|
|
389
|
+
export class IntersectionType extends Type {
|
|
390
|
+
types;
|
|
391
|
+
type = "intersection";
|
|
392
|
+
constructor(types) {
|
|
393
|
+
super();
|
|
394
|
+
this.types = types;
|
|
395
|
+
}
|
|
396
|
+
getTypeString() {
|
|
397
|
+
return this.types
|
|
398
|
+
.map((t) => t.stringify(TypeContext.intersectionElement))
|
|
399
|
+
.join(" & ");
|
|
400
|
+
}
|
|
401
|
+
needsParenthesis(context) {
|
|
402
|
+
const map = {
|
|
403
|
+
none: false,
|
|
404
|
+
templateLiteralElement: false,
|
|
405
|
+
arrayElement: true,
|
|
406
|
+
indexedAccessElement: false,
|
|
407
|
+
conditionalCheck: true,
|
|
408
|
+
conditionalExtends: false,
|
|
409
|
+
conditionalTrue: false,
|
|
410
|
+
conditionalFalse: false,
|
|
411
|
+
indexedIndex: false,
|
|
412
|
+
indexedObject: true,
|
|
413
|
+
inferredConstraint: false,
|
|
414
|
+
intersectionElement: false,
|
|
415
|
+
mappedName: false,
|
|
416
|
+
mappedParameter: false,
|
|
417
|
+
mappedTemplate: false,
|
|
418
|
+
optionalElement: true,
|
|
419
|
+
predicateTarget: false,
|
|
420
|
+
queryTypeTarget: false,
|
|
421
|
+
typeOperatorTarget: true,
|
|
422
|
+
referenceTypeArgument: false,
|
|
423
|
+
restElement: true,
|
|
424
|
+
tupleElement: false,
|
|
425
|
+
unionElement: false,
|
|
426
|
+
};
|
|
427
|
+
return map[context];
|
|
428
|
+
}
|
|
429
|
+
toObject(serializer) {
|
|
430
|
+
return {
|
|
431
|
+
type: this.type,
|
|
432
|
+
types: this.types.map((t) => serializer.toObject(t)),
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Represents an intrinsic type like `string` or `boolean`.
|
|
438
|
+
*
|
|
439
|
+
* ```ts
|
|
440
|
+
* let value: number;
|
|
441
|
+
* ```
|
|
442
|
+
* @category Types
|
|
443
|
+
*/
|
|
444
|
+
export class IntrinsicType extends Type {
|
|
445
|
+
name;
|
|
446
|
+
type = "intrinsic";
|
|
447
|
+
constructor(name) {
|
|
448
|
+
super();
|
|
449
|
+
this.name = name;
|
|
450
|
+
}
|
|
451
|
+
getTypeString() {
|
|
452
|
+
return this.name;
|
|
453
|
+
}
|
|
454
|
+
toObject() {
|
|
455
|
+
return {
|
|
456
|
+
type: this.type,
|
|
457
|
+
name: this.name,
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
needsParenthesis() {
|
|
461
|
+
return false;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Represents a literal type.
|
|
466
|
+
*
|
|
467
|
+
* ```ts
|
|
468
|
+
* type A = "A"
|
|
469
|
+
* type B = 1
|
|
470
|
+
* ```
|
|
471
|
+
* @category Types
|
|
472
|
+
*/
|
|
473
|
+
export class LiteralType extends Type {
|
|
474
|
+
value;
|
|
475
|
+
type = "literal";
|
|
476
|
+
constructor(value) {
|
|
477
|
+
super();
|
|
478
|
+
this.value = value;
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* Return a string representation of this type.
|
|
482
|
+
*/
|
|
483
|
+
getTypeString() {
|
|
484
|
+
if (typeof this.value === "bigint") {
|
|
485
|
+
return this.value.toString() + "n";
|
|
486
|
+
}
|
|
487
|
+
return JSON.stringify(this.value);
|
|
488
|
+
}
|
|
489
|
+
needsParenthesis() {
|
|
490
|
+
return false;
|
|
491
|
+
}
|
|
492
|
+
toObject() {
|
|
493
|
+
if (typeof this.value === "bigint") {
|
|
494
|
+
return {
|
|
495
|
+
type: this.type,
|
|
496
|
+
value: {
|
|
497
|
+
value: this.value.toString().replace("-", ""),
|
|
498
|
+
negative: this.value < BigInt("0"),
|
|
499
|
+
},
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
return {
|
|
503
|
+
type: this.type,
|
|
504
|
+
value: this.value,
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Represents a mapped type.
|
|
510
|
+
*
|
|
511
|
+
* ```ts
|
|
512
|
+
* { -readonly [K in Parameter as Name]?: Template }
|
|
513
|
+
* ```
|
|
514
|
+
* @category Types
|
|
515
|
+
*/
|
|
516
|
+
export class MappedType extends Type {
|
|
517
|
+
parameter;
|
|
518
|
+
parameterType;
|
|
519
|
+
templateType;
|
|
520
|
+
readonlyModifier;
|
|
521
|
+
optionalModifier;
|
|
522
|
+
nameType;
|
|
523
|
+
type = "mapped";
|
|
524
|
+
constructor(parameter, parameterType, templateType, readonlyModifier, optionalModifier, nameType) {
|
|
525
|
+
super();
|
|
526
|
+
this.parameter = parameter;
|
|
527
|
+
this.parameterType = parameterType;
|
|
528
|
+
this.templateType = templateType;
|
|
529
|
+
this.readonlyModifier = readonlyModifier;
|
|
530
|
+
this.optionalModifier = optionalModifier;
|
|
531
|
+
this.nameType = nameType;
|
|
532
|
+
}
|
|
533
|
+
getTypeString() {
|
|
534
|
+
const read = {
|
|
535
|
+
"+": "readonly ",
|
|
536
|
+
"-": "-readonly ",
|
|
537
|
+
"": "",
|
|
538
|
+
}[this.readonlyModifier ?? ""];
|
|
539
|
+
const opt = {
|
|
540
|
+
"+": "?",
|
|
541
|
+
"-": "-?",
|
|
542
|
+
"": "",
|
|
543
|
+
}[this.optionalModifier ?? ""];
|
|
544
|
+
const parts = [
|
|
545
|
+
"{ ",
|
|
546
|
+
read,
|
|
547
|
+
"[",
|
|
548
|
+
this.parameter,
|
|
549
|
+
" in ",
|
|
550
|
+
this.parameterType.stringify(TypeContext.mappedParameter),
|
|
551
|
+
];
|
|
552
|
+
if (this.nameType) {
|
|
553
|
+
parts.push(" as ", this.nameType.stringify(TypeContext.mappedName));
|
|
554
|
+
}
|
|
555
|
+
parts.push("]", opt, ": ", this.templateType.stringify(TypeContext.mappedTemplate), " }");
|
|
556
|
+
return parts.join("");
|
|
557
|
+
}
|
|
558
|
+
needsParenthesis() {
|
|
559
|
+
return false;
|
|
560
|
+
}
|
|
561
|
+
toObject(serializer) {
|
|
562
|
+
return {
|
|
563
|
+
type: this.type,
|
|
564
|
+
parameter: this.parameter,
|
|
565
|
+
parameterType: serializer.toObject(this.parameterType),
|
|
566
|
+
templateType: serializer.toObject(this.templateType),
|
|
567
|
+
readonlyModifier: this.readonlyModifier,
|
|
568
|
+
optionalModifier: this.optionalModifier,
|
|
569
|
+
nameType: serializer.toObject(this.nameType),
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* Represents an optional type
|
|
575
|
+
* ```ts
|
|
576
|
+
* type Z = [1, 2?]
|
|
577
|
+
* // ^^
|
|
578
|
+
* ```
|
|
579
|
+
* @category Types
|
|
580
|
+
*/
|
|
581
|
+
export class OptionalType extends Type {
|
|
582
|
+
elementType;
|
|
583
|
+
type = "optional";
|
|
584
|
+
constructor(elementType) {
|
|
585
|
+
super();
|
|
586
|
+
this.elementType = elementType;
|
|
587
|
+
}
|
|
588
|
+
getTypeString() {
|
|
589
|
+
return this.elementType.stringify(TypeContext.optionalElement) + "?";
|
|
590
|
+
}
|
|
591
|
+
needsParenthesis() {
|
|
592
|
+
return false;
|
|
593
|
+
}
|
|
594
|
+
toObject(serializer) {
|
|
595
|
+
return {
|
|
596
|
+
type: this.type,
|
|
597
|
+
elementType: serializer.toObject(this.elementType),
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* Represents a type predicate.
|
|
603
|
+
*
|
|
604
|
+
* ```ts
|
|
605
|
+
* function isString(x: unknown): x is string {}
|
|
606
|
+
* function assert(condition: boolean): asserts condition {}
|
|
607
|
+
* ```
|
|
608
|
+
* @category Types
|
|
609
|
+
*/
|
|
610
|
+
export class PredicateType extends Type {
|
|
611
|
+
name;
|
|
612
|
+
asserts;
|
|
613
|
+
targetType;
|
|
614
|
+
type = "predicate";
|
|
615
|
+
/**
|
|
616
|
+
* Create a new PredicateType instance.
|
|
617
|
+
*
|
|
618
|
+
* @param name The identifier name which is tested by the predicate.
|
|
619
|
+
* @param asserts True if the type is of the form `asserts val is string`,
|
|
620
|
+
* false if the type is of the form `val is string`
|
|
621
|
+
* @param targetType The type that the identifier is tested to be.
|
|
622
|
+
* May be undefined if the type is of the form `asserts val`.
|
|
623
|
+
* Will be defined if the type is of the form `asserts val is string` or `val is string`.
|
|
624
|
+
*/
|
|
625
|
+
constructor(name, asserts, targetType) {
|
|
626
|
+
super();
|
|
627
|
+
this.name = name;
|
|
628
|
+
this.asserts = asserts;
|
|
629
|
+
this.targetType = targetType;
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* Return a string representation of this type.
|
|
633
|
+
*/
|
|
634
|
+
getTypeString() {
|
|
635
|
+
const out = this.asserts ? ["asserts", this.name] : [this.name];
|
|
636
|
+
if (this.targetType) {
|
|
637
|
+
out.push("is", this.targetType.stringify(TypeContext.predicateTarget));
|
|
638
|
+
}
|
|
639
|
+
return out.join(" ");
|
|
640
|
+
}
|
|
641
|
+
needsParenthesis() {
|
|
642
|
+
return false;
|
|
643
|
+
}
|
|
644
|
+
toObject(serializer) {
|
|
645
|
+
return {
|
|
646
|
+
type: this.type,
|
|
647
|
+
name: this.name,
|
|
648
|
+
asserts: this.asserts,
|
|
649
|
+
targetType: serializer.toObject(this.targetType),
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* Represents a type that is constructed by querying the type of a reflection.
|
|
655
|
+
* ```ts
|
|
656
|
+
* const x = 1
|
|
657
|
+
* type Z = typeof x // query on reflection for x
|
|
658
|
+
* ```
|
|
659
|
+
* @category Types
|
|
660
|
+
*/
|
|
661
|
+
export class QueryType extends Type {
|
|
662
|
+
queryType;
|
|
663
|
+
type = "query";
|
|
664
|
+
constructor(queryType) {
|
|
665
|
+
super();
|
|
666
|
+
this.queryType = queryType;
|
|
667
|
+
}
|
|
668
|
+
getTypeString() {
|
|
669
|
+
return `typeof ${this.queryType.stringify(TypeContext.queryTypeTarget)}`;
|
|
670
|
+
}
|
|
671
|
+
/**
|
|
672
|
+
* @privateRemarks
|
|
673
|
+
* An argument could be made that this ought to return true for indexedObject
|
|
674
|
+
* since precedence is different than on the value side... if someone really cares
|
|
675
|
+
* they can easily use a custom theme to change this.
|
|
676
|
+
*/
|
|
677
|
+
needsParenthesis() {
|
|
678
|
+
return false;
|
|
679
|
+
}
|
|
680
|
+
toObject(serializer) {
|
|
681
|
+
return {
|
|
682
|
+
type: this.type,
|
|
683
|
+
queryType: serializer.toObject(this.queryType),
|
|
684
|
+
};
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Represents a type that refers to another reflection like a class, interface or enum.
|
|
689
|
+
*
|
|
690
|
+
* ```ts
|
|
691
|
+
* let value: MyClass<T>;
|
|
692
|
+
* ```
|
|
693
|
+
* @category Types
|
|
694
|
+
*/
|
|
695
|
+
let ReferenceType = (() => {
|
|
696
|
+
let _classSuper = Type;
|
|
697
|
+
let __project_decorators;
|
|
698
|
+
let __project_initializers = [];
|
|
699
|
+
let __project_extraInitializers = [];
|
|
700
|
+
return class ReferenceType extends _classSuper {
|
|
701
|
+
static {
|
|
702
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
703
|
+
__project_decorators = [NonEnumerable];
|
|
704
|
+
__esDecorate(null, null, __project_decorators, { kind: "field", name: "_project", static: false, private: false, access: { has: obj => "_project" in obj, get: obj => obj._project, set: (obj, value) => { obj._project = value; } }, metadata: _metadata }, __project_initializers, __project_extraInitializers);
|
|
705
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
706
|
+
}
|
|
707
|
+
type = "reference";
|
|
708
|
+
/**
|
|
709
|
+
* The name of the referenced type.
|
|
710
|
+
*
|
|
711
|
+
* If the symbol cannot be found because it's not part of the documentation this
|
|
712
|
+
* can be used to represent the type.
|
|
713
|
+
*/
|
|
714
|
+
name;
|
|
715
|
+
/**
|
|
716
|
+
* The type arguments of this reference.
|
|
717
|
+
*/
|
|
718
|
+
typeArguments;
|
|
719
|
+
/**
|
|
720
|
+
* The resolved reflection.
|
|
721
|
+
*/
|
|
722
|
+
get reflection() {
|
|
723
|
+
if (typeof this._target === "number") {
|
|
724
|
+
return this._project?.getReflectionById(this._target);
|
|
725
|
+
}
|
|
726
|
+
const resolvePotential = this._project?.getReflectionsFromSymbolId(this._target);
|
|
727
|
+
if (!resolvePotential?.length) {
|
|
728
|
+
return;
|
|
729
|
+
}
|
|
730
|
+
const kind = this.preferValues
|
|
731
|
+
? ReflectionKind.ValueReferenceTarget
|
|
732
|
+
: ReflectionKind.TypeReferenceTarget;
|
|
733
|
+
const resolved = resolvePotential.find((refl) => refl.kindOf(kind)) ||
|
|
734
|
+
resolvePotential.find((refl) => refl.kindOf(~kind));
|
|
735
|
+
// Do not mark the type as resolved at this point so that if it
|
|
736
|
+
// points to a member which is removed (e.g. by typedoc-plugin-zod)
|
|
737
|
+
// and then replaced it still ends up pointing at the right reflection.
|
|
738
|
+
// We will lock type reference resolution when serializing to JSON.
|
|
739
|
+
// this._target = resolved.id;
|
|
740
|
+
return resolved;
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* Sometimes a few properties are more important than the rest
|
|
744
|
+
* of the properties within a type. This occurs most often with
|
|
745
|
+
* object parameters, where users want to specify `@param foo.bar`
|
|
746
|
+
* to highlight something about the `bar` property.
|
|
747
|
+
*
|
|
748
|
+
* Does NOT support nested properties.
|
|
749
|
+
*/
|
|
750
|
+
highlightedProperties;
|
|
751
|
+
/**
|
|
752
|
+
* If not resolved, the symbol id of the reflection, otherwise undefined.
|
|
753
|
+
*/
|
|
754
|
+
get symbolId() {
|
|
755
|
+
if (!this.reflection && typeof this._target === "object") {
|
|
756
|
+
return this._target;
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
/**
|
|
760
|
+
* Checks if this type is a reference type because it uses a name, but is intentionally not pointing
|
|
761
|
+
* to a reflection. This happens for type parameters and when representing a mapped type.
|
|
762
|
+
*/
|
|
763
|
+
isIntentionallyBroken() {
|
|
764
|
+
if (typeof this._target === "object" &&
|
|
765
|
+
this._project?.symbolIdHasBeenRemoved(this._target)) {
|
|
766
|
+
return true;
|
|
767
|
+
}
|
|
768
|
+
return this._target === -1 || this.refersToTypeParameter;
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* Convert this reference type to a declaration reference used for resolution of external types.
|
|
772
|
+
*/
|
|
773
|
+
toDeclarationReference() {
|
|
774
|
+
return {
|
|
775
|
+
resolutionStart: "global",
|
|
776
|
+
moduleSource: this.package,
|
|
777
|
+
symbolReference: {
|
|
778
|
+
path: this.qualifiedName
|
|
779
|
+
.split(".")
|
|
780
|
+
.map((p) => ({ path: p, navigation: "." })),
|
|
781
|
+
},
|
|
782
|
+
};
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* The fully qualified name of the referenced type, relative to the file it is defined in.
|
|
786
|
+
* This will usually be the same as `name`, unless namespaces are used.
|
|
787
|
+
*/
|
|
788
|
+
qualifiedName;
|
|
789
|
+
/**
|
|
790
|
+
* The package that this type is referencing.
|
|
791
|
+
*/
|
|
792
|
+
package;
|
|
793
|
+
/**
|
|
794
|
+
* If this reference type refers to a reflection defined by a project not being rendered,
|
|
795
|
+
* points to the url that this type should be linked to.
|
|
796
|
+
*/
|
|
797
|
+
externalUrl;
|
|
798
|
+
/**
|
|
799
|
+
* If set, no warnings about something not being exported should be created
|
|
800
|
+
* since this may be referring to a type created with `infer X` which will not
|
|
801
|
+
* be registered on the project.
|
|
802
|
+
*/
|
|
803
|
+
refersToTypeParameter = false;
|
|
804
|
+
/**
|
|
805
|
+
* If set, will prefer reflections with {@link ReflectionKind | ReflectionKinds} which represent
|
|
806
|
+
* values rather than those which represent types.
|
|
807
|
+
*/
|
|
808
|
+
preferValues = false;
|
|
809
|
+
_target;
|
|
810
|
+
_project = __runInitializers(this, __project_initializers, void 0);
|
|
811
|
+
constructor(name, target, project, qualifiedName) {
|
|
812
|
+
super();
|
|
813
|
+
__runInitializers(this, __project_extraInitializers);
|
|
814
|
+
this.name = name;
|
|
815
|
+
if (typeof target === "number") {
|
|
816
|
+
this._target = target;
|
|
817
|
+
}
|
|
818
|
+
else {
|
|
819
|
+
this._target = "variant" in target ? target.id : target;
|
|
820
|
+
}
|
|
821
|
+
this._project = project;
|
|
822
|
+
this.qualifiedName = qualifiedName;
|
|
823
|
+
}
|
|
824
|
+
static createUnresolvedReference(name, target, project, qualifiedName) {
|
|
825
|
+
return new ReferenceType(name, target, project, qualifiedName);
|
|
826
|
+
}
|
|
827
|
+
static createResolvedReference(name, target, project) {
|
|
828
|
+
return new ReferenceType(name, target, project, name);
|
|
829
|
+
}
|
|
830
|
+
/**
|
|
831
|
+
* This is used for type parameters, which don't actually point to something,
|
|
832
|
+
* and also for temporary references which will be cleaned up with real references
|
|
833
|
+
* later during conversion.
|
|
834
|
+
* @internal
|
|
835
|
+
*/
|
|
836
|
+
static createBrokenReference(name, project, packageName) {
|
|
837
|
+
const ref = new ReferenceType(name, -1, project, name);
|
|
838
|
+
ref.package = packageName;
|
|
839
|
+
return ref;
|
|
840
|
+
}
|
|
841
|
+
getTypeString() {
|
|
842
|
+
const name = this.reflection ? this.reflection.name : this.name;
|
|
843
|
+
let typeArgs = "";
|
|
844
|
+
if (this.typeArguments && this.typeArguments.length > 0) {
|
|
845
|
+
typeArgs += "<";
|
|
846
|
+
typeArgs += this.typeArguments
|
|
847
|
+
.map((arg) => arg.stringify(TypeContext.referenceTypeArgument))
|
|
848
|
+
.join(", ");
|
|
849
|
+
typeArgs += ">";
|
|
850
|
+
}
|
|
851
|
+
return name + typeArgs;
|
|
852
|
+
}
|
|
853
|
+
needsParenthesis() {
|
|
854
|
+
return false;
|
|
855
|
+
}
|
|
856
|
+
toObject(serializer) {
|
|
857
|
+
let target;
|
|
858
|
+
if (typeof this._target === "number") {
|
|
859
|
+
target = this._target;
|
|
860
|
+
}
|
|
861
|
+
else if (this._project?.symbolIdHasBeenRemoved(this._target)) {
|
|
862
|
+
target = -1;
|
|
863
|
+
}
|
|
864
|
+
else if (this.reflection) {
|
|
865
|
+
target = this.reflection.id;
|
|
866
|
+
}
|
|
867
|
+
else {
|
|
868
|
+
target = this._target.toObject();
|
|
869
|
+
}
|
|
870
|
+
const result = {
|
|
871
|
+
type: this.type,
|
|
872
|
+
target,
|
|
873
|
+
typeArguments: serializer.toObjectsOptional(this.typeArguments),
|
|
874
|
+
name: this.name,
|
|
875
|
+
package: this.package,
|
|
876
|
+
externalUrl: this.externalUrl,
|
|
877
|
+
};
|
|
878
|
+
if (this.name !== this.qualifiedName) {
|
|
879
|
+
result.qualifiedName = this.qualifiedName;
|
|
880
|
+
}
|
|
881
|
+
if (this.refersToTypeParameter) {
|
|
882
|
+
result.refersToTypeParameter = true;
|
|
883
|
+
}
|
|
884
|
+
if (typeof target !== "number" && this.preferValues) {
|
|
885
|
+
result.preferValues = true;
|
|
886
|
+
}
|
|
887
|
+
if (this.highlightedProperties) {
|
|
888
|
+
result.highlightedProperties = Object.fromEntries(Array.from(this.highlightedProperties.entries(), ([key, parts]) => {
|
|
889
|
+
return [
|
|
890
|
+
key,
|
|
891
|
+
Comment.serializeDisplayParts(parts),
|
|
892
|
+
];
|
|
893
|
+
}));
|
|
894
|
+
}
|
|
895
|
+
return result;
|
|
896
|
+
}
|
|
897
|
+
fromObject(de, obj) {
|
|
898
|
+
this.typeArguments = de.reviveMany(obj.typeArguments, (t) => de.constructType(t));
|
|
899
|
+
if (typeof obj.target === "number") {
|
|
900
|
+
if (obj.target === -1) {
|
|
901
|
+
this._target = -1;
|
|
902
|
+
}
|
|
903
|
+
else {
|
|
904
|
+
de.defer((project) => {
|
|
905
|
+
const target = project.getReflectionById(de.oldIdToNewId[obj.target] ?? -1);
|
|
906
|
+
if (target) {
|
|
907
|
+
this._project = project;
|
|
908
|
+
this._target = target.id;
|
|
909
|
+
}
|
|
910
|
+
else {
|
|
911
|
+
de.logger.warn(i18n.serialized_project_referenced_0_not_part_of_project(JSON.stringify(obj.target)));
|
|
912
|
+
}
|
|
913
|
+
});
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
else {
|
|
917
|
+
this._project = de.project;
|
|
918
|
+
this._target = new ReflectionSymbolId(obj.target);
|
|
919
|
+
}
|
|
920
|
+
this.qualifiedName = obj.qualifiedName ?? obj.name;
|
|
921
|
+
this.package = obj.package;
|
|
922
|
+
this.refersToTypeParameter = !!obj.refersToTypeParameter;
|
|
923
|
+
this.preferValues = !!obj.preferValues;
|
|
924
|
+
if (obj.highlightedProperties) {
|
|
925
|
+
this.highlightedProperties = new Map();
|
|
926
|
+
for (const [key, parts] of Object.entries(obj.highlightedProperties)) {
|
|
927
|
+
this.highlightedProperties.set(key, Comment.deserializeDisplayParts(de, parts));
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
};
|
|
932
|
+
})();
|
|
933
|
+
export { ReferenceType };
|
|
934
|
+
/**
|
|
935
|
+
* Represents a type which has it's own reflection like literal types.
|
|
936
|
+
* This type will likely go away at some point and be replaced by a dedicated
|
|
937
|
+
* `ObjectType`. Allowing reflections to be nested within types causes much
|
|
938
|
+
* pain in the rendering code.
|
|
939
|
+
*
|
|
940
|
+
* ```ts
|
|
941
|
+
* let value: { a: string, b: number };
|
|
942
|
+
* ```
|
|
943
|
+
* @category Types
|
|
944
|
+
*/
|
|
945
|
+
export class ReflectionType extends Type {
|
|
946
|
+
declaration;
|
|
947
|
+
type = "reflection";
|
|
948
|
+
constructor(declaration) {
|
|
949
|
+
super();
|
|
950
|
+
this.declaration = declaration;
|
|
951
|
+
}
|
|
952
|
+
getTypeString() {
|
|
953
|
+
const parts = [];
|
|
954
|
+
const sigs = this.declaration.getNonIndexSignatures();
|
|
955
|
+
for (const sig of sigs) {
|
|
956
|
+
parts.push(sigStr(sig, ": "));
|
|
957
|
+
}
|
|
958
|
+
for (const p of this.declaration.children || []) {
|
|
959
|
+
parts.push(`${p.name}${propertySep(p)} ${typeStr(p.type)}`);
|
|
960
|
+
}
|
|
961
|
+
for (const s of this.declaration.indexSignatures || []) {
|
|
962
|
+
parts.push(sigStr(s, ": ", "[]"));
|
|
963
|
+
}
|
|
964
|
+
if (sigs.length === 1 && parts.length === 1) {
|
|
965
|
+
return sigStr(sigs[0], " => ");
|
|
966
|
+
}
|
|
967
|
+
if (parts.length === 0) {
|
|
968
|
+
return "{}";
|
|
969
|
+
}
|
|
970
|
+
return `{ ${parts.join("; ")} }`;
|
|
971
|
+
}
|
|
972
|
+
needsParenthesis(where) {
|
|
973
|
+
if (this.declaration.children || this.declaration.indexSignatures) {
|
|
974
|
+
return false;
|
|
975
|
+
}
|
|
976
|
+
if (this.declaration.signatures?.length === 1) {
|
|
977
|
+
return where === TypeContext.arrayElement || where === TypeContext.unionElement;
|
|
978
|
+
}
|
|
979
|
+
return false;
|
|
980
|
+
}
|
|
981
|
+
toObject(serializer) {
|
|
982
|
+
return {
|
|
983
|
+
type: this.type,
|
|
984
|
+
declaration: serializer.toObject(this.declaration),
|
|
985
|
+
};
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
/**
|
|
989
|
+
* Represents a rest type
|
|
990
|
+
* ```ts
|
|
991
|
+
* type Z = [1, ...2[]]
|
|
992
|
+
* // ^^^^^^
|
|
993
|
+
* ```
|
|
994
|
+
* @category Types
|
|
995
|
+
*/
|
|
996
|
+
export class RestType extends Type {
|
|
997
|
+
elementType;
|
|
998
|
+
type = "rest";
|
|
999
|
+
constructor(elementType) {
|
|
1000
|
+
super();
|
|
1001
|
+
this.elementType = elementType;
|
|
1002
|
+
}
|
|
1003
|
+
getTypeString() {
|
|
1004
|
+
return `...${this.elementType.stringify(TypeContext.restElement)}`;
|
|
1005
|
+
}
|
|
1006
|
+
needsParenthesis() {
|
|
1007
|
+
return false;
|
|
1008
|
+
}
|
|
1009
|
+
toObject(serializer) {
|
|
1010
|
+
return {
|
|
1011
|
+
type: this.type,
|
|
1012
|
+
elementType: serializer.toObject(this.elementType),
|
|
1013
|
+
};
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
/**
|
|
1017
|
+
* TS 4.1 template literal types
|
|
1018
|
+
* ```ts
|
|
1019
|
+
* type Z = `${'a' | 'b'}${'a' | 'b'}`
|
|
1020
|
+
* ```
|
|
1021
|
+
* @category Types
|
|
1022
|
+
*/
|
|
1023
|
+
export class TemplateLiteralType extends Type {
|
|
1024
|
+
head;
|
|
1025
|
+
tail;
|
|
1026
|
+
type = "templateLiteral";
|
|
1027
|
+
constructor(head, tail) {
|
|
1028
|
+
super();
|
|
1029
|
+
this.head = head;
|
|
1030
|
+
this.tail = tail;
|
|
1031
|
+
}
|
|
1032
|
+
getTypeString() {
|
|
1033
|
+
return [
|
|
1034
|
+
"`",
|
|
1035
|
+
this.head,
|
|
1036
|
+
...this.tail.map(([type, text]) => {
|
|
1037
|
+
return ("${" +
|
|
1038
|
+
type.stringify(TypeContext.templateLiteralElement) +
|
|
1039
|
+
"}" +
|
|
1040
|
+
text);
|
|
1041
|
+
}),
|
|
1042
|
+
"`",
|
|
1043
|
+
].join("");
|
|
1044
|
+
}
|
|
1045
|
+
needsParenthesis() {
|
|
1046
|
+
return false;
|
|
1047
|
+
}
|
|
1048
|
+
toObject(serializer) {
|
|
1049
|
+
return {
|
|
1050
|
+
type: this.type,
|
|
1051
|
+
head: this.head,
|
|
1052
|
+
tail: this.tail.map(([type, text]) => [
|
|
1053
|
+
serializer.toObject(type),
|
|
1054
|
+
text,
|
|
1055
|
+
]),
|
|
1056
|
+
};
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
/**
|
|
1060
|
+
* Represents a tuple type.
|
|
1061
|
+
*
|
|
1062
|
+
* ```ts
|
|
1063
|
+
* let value: [string, boolean];
|
|
1064
|
+
* ```
|
|
1065
|
+
* @category Types
|
|
1066
|
+
*/
|
|
1067
|
+
export class TupleType extends Type {
|
|
1068
|
+
elements;
|
|
1069
|
+
type = "tuple";
|
|
1070
|
+
/**
|
|
1071
|
+
* @param elements The ordered type elements of the tuple type.
|
|
1072
|
+
*/
|
|
1073
|
+
constructor(elements) {
|
|
1074
|
+
super();
|
|
1075
|
+
this.elements = elements;
|
|
1076
|
+
}
|
|
1077
|
+
getTypeString() {
|
|
1078
|
+
return ("[" +
|
|
1079
|
+
this.elements
|
|
1080
|
+
.map((t) => t.stringify(TypeContext.tupleElement))
|
|
1081
|
+
.join(", ") +
|
|
1082
|
+
"]");
|
|
1083
|
+
}
|
|
1084
|
+
needsParenthesis() {
|
|
1085
|
+
return false;
|
|
1086
|
+
}
|
|
1087
|
+
toObject(serializer) {
|
|
1088
|
+
return {
|
|
1089
|
+
type: this.type,
|
|
1090
|
+
elements: serializer.toObjectsOptional(this.elements),
|
|
1091
|
+
};
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
/**
|
|
1095
|
+
* Represents a named member of a tuple type.
|
|
1096
|
+
*
|
|
1097
|
+
* ```ts
|
|
1098
|
+
* let value: [name: string];
|
|
1099
|
+
* ```
|
|
1100
|
+
* @category Types
|
|
1101
|
+
*/
|
|
1102
|
+
export class NamedTupleMember extends Type {
|
|
1103
|
+
name;
|
|
1104
|
+
isOptional;
|
|
1105
|
+
element;
|
|
1106
|
+
type = "namedTupleMember";
|
|
1107
|
+
constructor(name, isOptional, element) {
|
|
1108
|
+
super();
|
|
1109
|
+
this.name = name;
|
|
1110
|
+
this.isOptional = isOptional;
|
|
1111
|
+
this.element = element;
|
|
1112
|
+
}
|
|
1113
|
+
/**
|
|
1114
|
+
* Return a string representation of this type.
|
|
1115
|
+
*/
|
|
1116
|
+
getTypeString() {
|
|
1117
|
+
return `${this.name}${this.isOptional ? "?" : ""}: ${this.element.stringify(TypeContext.tupleElement)}`;
|
|
1118
|
+
}
|
|
1119
|
+
needsParenthesis() {
|
|
1120
|
+
return false;
|
|
1121
|
+
}
|
|
1122
|
+
toObject(serializer) {
|
|
1123
|
+
return {
|
|
1124
|
+
type: this.type,
|
|
1125
|
+
name: this.name,
|
|
1126
|
+
isOptional: this.isOptional,
|
|
1127
|
+
element: serializer.toObject(this.element),
|
|
1128
|
+
};
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
/**
|
|
1132
|
+
* Represents a type operator type.
|
|
1133
|
+
*
|
|
1134
|
+
* ```ts
|
|
1135
|
+
* class A {}
|
|
1136
|
+
* class B<T extends keyof A> {}
|
|
1137
|
+
* ```
|
|
1138
|
+
* @category Types
|
|
1139
|
+
*/
|
|
1140
|
+
export class TypeOperatorType extends Type {
|
|
1141
|
+
target;
|
|
1142
|
+
operator;
|
|
1143
|
+
type = "typeOperator";
|
|
1144
|
+
constructor(target, operator) {
|
|
1145
|
+
super();
|
|
1146
|
+
this.target = target;
|
|
1147
|
+
this.operator = operator;
|
|
1148
|
+
}
|
|
1149
|
+
getTypeString() {
|
|
1150
|
+
return `${this.operator} ${this.target.stringify(TypeContext.typeOperatorTarget)}`;
|
|
1151
|
+
}
|
|
1152
|
+
needsParenthesis(context) {
|
|
1153
|
+
const map = {
|
|
1154
|
+
none: false,
|
|
1155
|
+
templateLiteralElement: false,
|
|
1156
|
+
arrayElement: true,
|
|
1157
|
+
indexedAccessElement: false,
|
|
1158
|
+
conditionalCheck: false,
|
|
1159
|
+
conditionalExtends: false,
|
|
1160
|
+
conditionalTrue: false,
|
|
1161
|
+
conditionalFalse: false,
|
|
1162
|
+
indexedIndex: false,
|
|
1163
|
+
indexedObject: true,
|
|
1164
|
+
inferredConstraint: false,
|
|
1165
|
+
intersectionElement: false,
|
|
1166
|
+
mappedName: false,
|
|
1167
|
+
mappedParameter: false,
|
|
1168
|
+
mappedTemplate: false,
|
|
1169
|
+
optionalElement: true,
|
|
1170
|
+
predicateTarget: false,
|
|
1171
|
+
queryTypeTarget: false,
|
|
1172
|
+
typeOperatorTarget: false,
|
|
1173
|
+
referenceTypeArgument: false,
|
|
1174
|
+
restElement: false,
|
|
1175
|
+
tupleElement: false,
|
|
1176
|
+
unionElement: false,
|
|
1177
|
+
};
|
|
1178
|
+
return map[context];
|
|
1179
|
+
}
|
|
1180
|
+
toObject(serializer) {
|
|
1181
|
+
return {
|
|
1182
|
+
type: this.type,
|
|
1183
|
+
operator: this.operator,
|
|
1184
|
+
target: serializer.toObject(this.target),
|
|
1185
|
+
};
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
/**
|
|
1189
|
+
* Represents an union type.
|
|
1190
|
+
*
|
|
1191
|
+
* ```ts
|
|
1192
|
+
* let value: string | string[];
|
|
1193
|
+
* ```
|
|
1194
|
+
* @category Types
|
|
1195
|
+
*/
|
|
1196
|
+
export class UnionType extends Type {
|
|
1197
|
+
types;
|
|
1198
|
+
type = "union";
|
|
1199
|
+
/**
|
|
1200
|
+
* If present, there should be as many items in this array as there are items in the {@link types} array.
|
|
1201
|
+
*
|
|
1202
|
+
* This member is only valid on unions which are on {@link DeclarationReflection.type | DeclarationReflection.type} with a
|
|
1203
|
+
* {@link ReflectionKind} `kind` of `TypeAlias`. Specifying it on any other union is undefined behavior.
|
|
1204
|
+
*/
|
|
1205
|
+
elementSummaries;
|
|
1206
|
+
constructor(types) {
|
|
1207
|
+
super();
|
|
1208
|
+
this.types = types;
|
|
1209
|
+
}
|
|
1210
|
+
getTypeString() {
|
|
1211
|
+
return this.types
|
|
1212
|
+
.map((t) => t.stringify(TypeContext.unionElement))
|
|
1213
|
+
.join(" | ");
|
|
1214
|
+
}
|
|
1215
|
+
needsParenthesis(context) {
|
|
1216
|
+
const map = {
|
|
1217
|
+
none: false,
|
|
1218
|
+
templateLiteralElement: false,
|
|
1219
|
+
arrayElement: true,
|
|
1220
|
+
indexedAccessElement: false,
|
|
1221
|
+
conditionalCheck: true,
|
|
1222
|
+
conditionalExtends: false,
|
|
1223
|
+
conditionalTrue: false,
|
|
1224
|
+
conditionalFalse: false,
|
|
1225
|
+
indexedIndex: false,
|
|
1226
|
+
indexedObject: true,
|
|
1227
|
+
inferredConstraint: false,
|
|
1228
|
+
intersectionElement: true,
|
|
1229
|
+
mappedName: false,
|
|
1230
|
+
mappedParameter: false,
|
|
1231
|
+
mappedTemplate: false,
|
|
1232
|
+
optionalElement: true,
|
|
1233
|
+
predicateTarget: false,
|
|
1234
|
+
queryTypeTarget: false,
|
|
1235
|
+
typeOperatorTarget: true,
|
|
1236
|
+
referenceTypeArgument: false,
|
|
1237
|
+
restElement: false,
|
|
1238
|
+
tupleElement: false,
|
|
1239
|
+
unionElement: false,
|
|
1240
|
+
};
|
|
1241
|
+
return map[context];
|
|
1242
|
+
}
|
|
1243
|
+
fromObject(de, obj) {
|
|
1244
|
+
if (obj.elementSummaries) {
|
|
1245
|
+
this.elementSummaries = obj.elementSummaries.map((parts) => Comment.deserializeDisplayParts(de, parts));
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
toObject(serializer) {
|
|
1249
|
+
return {
|
|
1250
|
+
type: this.type,
|
|
1251
|
+
types: this.types.map((t) => serializer.toObject(t)),
|
|
1252
|
+
elementSummaries: this.elementSummaries?.map((parts) => Comment.serializeDisplayParts(parts)),
|
|
1253
|
+
};
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
/**
|
|
1257
|
+
* Represents all unknown types that cannot be converted by TypeDoc.
|
|
1258
|
+
* @category Types
|
|
1259
|
+
*/
|
|
1260
|
+
export class UnknownType extends Type {
|
|
1261
|
+
type = "unknown";
|
|
1262
|
+
/**
|
|
1263
|
+
* A string representation of the type as returned from TypeScript compiler.
|
|
1264
|
+
*/
|
|
1265
|
+
name;
|
|
1266
|
+
constructor(name) {
|
|
1267
|
+
super();
|
|
1268
|
+
this.name = name;
|
|
1269
|
+
}
|
|
1270
|
+
getTypeString() {
|
|
1271
|
+
return this.name;
|
|
1272
|
+
}
|
|
1273
|
+
/**
|
|
1274
|
+
* Always returns true if not at the root level, we have no idea what's in here, so wrap it in parenthesis
|
|
1275
|
+
* to be extra safe.
|
|
1276
|
+
*/
|
|
1277
|
+
needsParenthesis(context) {
|
|
1278
|
+
return context !== TypeContext.none;
|
|
1279
|
+
}
|
|
1280
|
+
toObject() {
|
|
1281
|
+
return {
|
|
1282
|
+
type: this.type,
|
|
1283
|
+
name: this.name,
|
|
1284
|
+
};
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
function propertySep(refl) {
|
|
1288
|
+
return refl.flags.isOptional ? "?:" : ":";
|
|
1289
|
+
}
|
|
1290
|
+
function typeStr(type) {
|
|
1291
|
+
return type?.toString() ?? "any";
|
|
1292
|
+
}
|
|
1293
|
+
function sigStr(sig, sep, brackets = "()") {
|
|
1294
|
+
const params = joinArray(sig.parameters, ", ", (p) => `${p.name}${propertySep(p)} ${typeStr(p.type)}`);
|
|
1295
|
+
return `${brackets[0]}${params}${brackets[1]}${sep}${typeStr(sig.type)}`;
|
|
1296
|
+
}
|