diff --git a/theme/v2/partials/type.hbs b/theme/v2/partials/type.hbs index f226d52..1e19959 100644 --- a/theme/v2/partials/type.hbs +++ b/theme/v2/partials/type.hbs @@ -73,9 +73,61 @@ if an inner type may result in invalid output without them. For example: {{name}} {{/inline}} +{{#*inline 'literal'}} + {{stringify value}} +{{/inline}} + +{{#*inline 'mapped'}} + { + {{#ifCond readonlyModifier '===' '+'}} + readonly + {{else}} + {{#ifCond readonlyModifier '===' '-'}} + -readonly + {{/ifCond}} + {{/ifCond}} + + [ + {{parameter}} + in + + {{#with parameterType}} + {{>type}} + {{/with}} + + {{#with nameType}} + as + {{>type}} + {{/with}} + + ] + {{#ifCond readonlyModifier '===' '+'}} + ?: + {{else}} + {{#ifCond readonlyModifier '===' '-'}} + -?: + {{else}} + : + {{/ifCond}} + {{/ifCond}} + + {{#with templateType}} + {{>type}} + {{/with}} + + } +{{/inline}} + +{{#*inline 'optional'}} + {{#with elementType}} + {{> type}} + {{/with}} + ? +{{/inline}} + {{#*inline 'predicate'}} {{#if asserts}} - asserts + asserts {{/if}} {{name}} {{#if targetType}} @@ -94,13 +146,13 @@ if an inner type may result in invalid output without them. For example: {{/inline}} {{#*inline 'reference'}} - {{#if reflection}} - - {{reflection.name}} + {{#with getReflection }} + + {{name}} {{else}} {{name}} - {{/if}} + {{/with}} {{#if typeArguments}} < {{#each typeArguments}} @@ -120,17 +172,56 @@ if an inner type may result in invalid output without them. For example: {{#unless @first}} ; {{/unless}} - {{name}} - {{#if flags.isOptional }} - ?: + + {{#if getSignature}} + {{#if setSignature}} + {{name}} + : + {{#with getSignature.type}} + {{> type}} + {{else}} + any + {{/with}} + {{else}} + get + {{name}} + (): + {{#with getSignature.type}} + {{> type}} + {{else}} + any + {{/with}} + {{/if}} {{else}} - : + {{#if setSignature}} + set + {{name}} + ( + {{! Rather hacky to use each here... but we know there is exactly one. }} + {{#each setSignature.parameters}} + {{name}} + : + {{#with type}} + {{> type}} + {{else}} + any + {{/with}} + {{/each}} + ) + {{else}} + {{name}} + {{#if flags.isOptional }} + ?: + {{else}} + : + {{/if}} + {{#with type}} + {{> type}} + {{else}} + any + {{/with}} + {{/if}} {{/if}} - {{#with type}} - {{> type}} - {{else}} - any - {{/with}} {{/each}} } {{else if declaration.signatures}} @@ -159,8 +250,11 @@ if an inner type may result in invalid output without them. For example: {{/if}} {{/inline}} -{{#*inline 'stringLiteral'}} - "{{value}}" +{{#*inline 'rest'}} + ... + {{#with elementType}} + {{> type}} + {{/with}} {{/inline}} {{#*inline 'tuple'}} @@ -174,6 +268,24 @@ if an inner type may result in invalid output without them. For example: ] {{/inline}} +{{#*inline 'template-literal'}} + ` + {{#if head}} + {{head}} + {{/if}} + {{#each tail}} + ${ + {{#with this.[0]}} + {{>type}} + {{/with}} + } + {{#if this.[1]}} + {{this.[1]}} + {{/if}} + {{/each}} + ` +{{/inline}} + {{#*inline 'typeOperator'}} {{operator}} {{#with target}} @@ -204,6 +316,18 @@ if an inner type may result in invalid output without them. For example: {{name}} {{/inline}} +{{#*inline 'named-tuple-member'}} + {{name}} + {{#if isOptional}} + ?: + {{else}} + : + {{/if}} + {{#with element}} + {{> type}} + {{/with}} +{{/inline}} + {{#if this}} {{> (lookup . 'type') }} {{else}}