Include matching return type using arrow in method declaration
Fixes #836
This commit is contained in:
Родитель
0355d152b1
Коммит
7e4ccfde81
|
@ -709,6 +709,7 @@ repository:
|
|||
- include: '#type-parameters'
|
||||
- include: '#function-parameters'
|
||||
- include: '#return-type'
|
||||
- include: '#type-function-return-type'
|
||||
- include: '#decl-block'
|
||||
- name: keyword.generator.asterisk.ts
|
||||
match: \*
|
||||
|
|
|
@ -2184,6 +2184,10 @@
|
|||
<key>include</key>
|
||||
<string>#return-type</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#type-function-return-type</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#decl-block</string>
|
||||
|
|
|
@ -2204,6 +2204,10 @@
|
|||
<key>include</key>
|
||||
<string>#return-type</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#type-function-return-type</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#decl-block</string>
|
||||
|
|
|
@ -0,0 +1,196 @@
|
|||
original file
|
||||
-----------------------------------
|
||||
const _actions = {} as {
|
||||
[P in keyof Actions] : PropType<Parameters<Actions[P]> , "0"> extends object ?
|
||||
(payload: PropType<Parameters<Actions[P]> , "0">) => void
|
||||
:
|
||||
() => void;
|
||||
};
|
||||
-----------------------------------
|
||||
|
||||
Grammar: TypeScript.tmLanguage
|
||||
-----------------------------------
|
||||
>const _actions = {} as {
|
||||
^^^^^
|
||||
source.ts meta.var.expr.ts storage.type.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts
|
||||
^^^^^^^^
|
||||
source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.definition.variable.ts variable.other.constant.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.var-single-variable.expr.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts keyword.operator.assignment.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts punctuation.definition.block.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts punctuation.definition.block.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts
|
||||
^^
|
||||
source.ts meta.var.expr.ts keyword.control.as.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts punctuation.definition.block.ts
|
||||
> [P in keyof Actions] : PropType<Parameters<Actions[P]> , "0"> extends object ?
|
||||
^^^^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.indexer.mappedtype.declaration.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.indexer.mappedtype.declaration.ts meta.brace.square.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.indexer.mappedtype.declaration.ts entity.name.type.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.indexer.mappedtype.declaration.ts
|
||||
^^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.indexer.mappedtype.declaration.ts keyword.operator.expression.in.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.indexer.mappedtype.declaration.ts
|
||||
^^^^^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.indexer.mappedtype.declaration.ts keyword.operator.expression.keyof.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.indexer.mappedtype.declaration.ts
|
||||
^^^^^^^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.indexer.mappedtype.declaration.ts entity.name.type.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.indexer.mappedtype.declaration.ts meta.brace.square.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.indexer.mappedtype.declaration.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts keyword.operator.type.annotation.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts
|
||||
^^^^^^^^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts entity.name.type.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.parameters.ts punctuation.definition.typeparameters.begin.ts
|
||||
^^^^^^^^^^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.parameters.ts entity.name.type.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.parameters.ts meta.type.parameters.ts punctuation.definition.typeparameters.begin.ts
|
||||
^^^^^^^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.parameters.ts meta.type.parameters.ts entity.name.type.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.parameters.ts meta.type.parameters.ts meta.type.tuple.ts meta.brace.square.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.parameters.ts meta.type.parameters.ts meta.type.tuple.ts entity.name.type.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.parameters.ts meta.type.parameters.ts meta.type.tuple.ts meta.brace.square.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.parameters.ts meta.type.parameters.ts punctuation.definition.typeparameters.end.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.parameters.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.parameters.ts punctuation.separator.comma.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.parameters.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.parameters.ts string.quoted.double.ts punctuation.definition.string.begin.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.parameters.ts string.quoted.double.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.parameters.ts string.quoted.double.ts punctuation.definition.string.end.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.parameters.ts punctuation.definition.typeparameters.end.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts
|
||||
^^^^^^^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts storage.modifier.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts
|
||||
^^^^^^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts support.type.builtin.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts keyword.operator.ternary.ts
|
||||
^^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts
|
||||
> (payload: PropType<Parameters<Actions[P]> , "0">) => void
|
||||
^^^^^^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.function.ts meta.parameters.ts punctuation.definition.parameters.begin.ts
|
||||
^^^^^^^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.function.ts meta.parameters.ts variable.parameter.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.function.ts meta.parameters.ts meta.type.annotation.ts keyword.operator.type.annotation.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.function.ts meta.parameters.ts meta.type.annotation.ts
|
||||
^^^^^^^^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.function.ts meta.parameters.ts meta.type.annotation.ts entity.name.type.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.function.ts meta.parameters.ts meta.type.annotation.ts meta.type.parameters.ts punctuation.definition.typeparameters.begin.ts
|
||||
^^^^^^^^^^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.function.ts meta.parameters.ts meta.type.annotation.ts meta.type.parameters.ts entity.name.type.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.function.ts meta.parameters.ts meta.type.annotation.ts meta.type.parameters.ts meta.type.parameters.ts punctuation.definition.typeparameters.begin.ts
|
||||
^^^^^^^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.function.ts meta.parameters.ts meta.type.annotation.ts meta.type.parameters.ts meta.type.parameters.ts entity.name.type.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.function.ts meta.parameters.ts meta.type.annotation.ts meta.type.parameters.ts meta.type.parameters.ts meta.type.tuple.ts meta.brace.square.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.function.ts meta.parameters.ts meta.type.annotation.ts meta.type.parameters.ts meta.type.parameters.ts meta.type.tuple.ts entity.name.type.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.function.ts meta.parameters.ts meta.type.annotation.ts meta.type.parameters.ts meta.type.parameters.ts meta.type.tuple.ts meta.brace.square.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.function.ts meta.parameters.ts meta.type.annotation.ts meta.type.parameters.ts meta.type.parameters.ts punctuation.definition.typeparameters.end.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.function.ts meta.parameters.ts meta.type.annotation.ts meta.type.parameters.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.function.ts meta.parameters.ts meta.type.annotation.ts meta.type.parameters.ts punctuation.separator.comma.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.function.ts meta.parameters.ts meta.type.annotation.ts meta.type.parameters.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.function.ts meta.parameters.ts meta.type.annotation.ts meta.type.parameters.ts string.quoted.double.ts punctuation.definition.string.begin.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.function.ts meta.parameters.ts meta.type.annotation.ts meta.type.parameters.ts string.quoted.double.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.function.ts meta.parameters.ts meta.type.annotation.ts meta.type.parameters.ts string.quoted.double.ts punctuation.definition.string.end.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.function.ts meta.parameters.ts meta.type.annotation.ts meta.type.parameters.ts punctuation.definition.typeparameters.end.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.function.ts meta.parameters.ts punctuation.definition.parameters.end.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts
|
||||
^^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.function.return.ts storage.type.function.arrow.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.function.return.ts
|
||||
^^^^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.function.return.ts support.type.primitive.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts meta.type.function.return.ts
|
||||
> :
|
||||
^^^^^^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts keyword.operator.ternary.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.type.annotation.ts
|
||||
> () => void;
|
||||
^^^^^^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.method.declaration.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.method.declaration.ts meta.parameters.ts punctuation.definition.parameters.begin.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.method.declaration.ts meta.parameters.ts punctuation.definition.parameters.end.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.method.declaration.ts
|
||||
^^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.method.declaration.ts meta.type.function.return.ts storage.type.function.arrow.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.method.declaration.ts meta.type.function.return.ts
|
||||
^^^^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts meta.method.declaration.ts meta.type.function.return.ts support.type.primitive.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts punctuation.terminator.statement.ts
|
||||
> };
|
||||
^^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.object.type.ts punctuation.definition.block.ts
|
||||
^
|
||||
source.ts punctuation.terminator.statement.ts
|
|
@ -0,0 +1,6 @@
|
|||
const _actions = {} as {
|
||||
[P in keyof Actions] : PropType<Parameters<Actions[P]> , "0"> extends object ?
|
||||
(payload: PropType<Parameters<Actions[P]> , "0">) => void
|
||||
:
|
||||
() => void;
|
||||
};
|
Загрузка…
Ссылка в новой задаче