Skip to content

Commit

Permalink
Parser: fn type as type arg
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanjermakov committed Apr 8, 2024
1 parent bd979d2 commit d68e637
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/parser/fns/expr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export const parseIdentifier = (parser: Parser): void => {
}
if (
parser.at('o-angle') &&
parser.encounter('c-angle', [...nameLikeTokens, 'colon', 'comma', 'o-angle', 'underscore'])
parser.encounter('c-angle', [...nameLikeTokens, 'colon', 'comma', 'o-angle', 'underscore', 'pipe'])
) {
parseTypeArgs(parser)
}
Expand Down
2 changes: 1 addition & 1 deletion src/parser/fns/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const parseFnType = (parser: Parser): void => {
export const parseFnTypeParams = (parser: Parser): void => {
const mark = parser.open()
parser.expect('pipe')
while (!parser.at('pipe') && !parser.eof()) {
while (!(parser.at('pipe') && parser.nth(1) === 'colon') && !parser.eof()) {
parseType(parser)
if (!parser.at('pipe')) {
parser.expect('comma')
Expand Down

0 comments on commit d68e637

Please sign in to comment.