Skip to content

Commit b88cd23

Browse files
authored
feat: bump ts-api-utils to v0.0.22 (typescript-eslint#6472)
1 parent cd26357 commit b88cd23

File tree

6 files changed

+14
-12
lines changed

6 files changed

+14
-12
lines changed

packages/eslint-plugin/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"natural-compare-lite": "^1.4.0",
5454
"regexpp": "^3.2.0",
5555
"semver": "^7.3.7",
56-
"ts-api-utils": "^0.0.21"
56+
"ts-api-utils": "^0.0.22"
5757
},
5858
"devDependencies": {
5959
"@types/debug": "*",

packages/eslint-plugin/src/rules/no-unsafe-return.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { TSESTree } from '@typescript-eslint/utils';
22
import { AST_NODE_TYPES } from '@typescript-eslint/utils';
33
import * as tools from 'ts-api-utils';
4+
import * as ts from 'typescript';
45

56
import * as util from '../util';
67
import { getThisExpression } from '../util';
@@ -82,9 +83,11 @@ export default util.createRule({
8283
// so we have to use the contextual typing in these cases, i.e.
8384
// const foo1: () => Set<string> = () => new Set<any>();
8485
// the return type of the arrow function is Set<any> even though the variable is typed as Set<string>
85-
let functionType = tools.isExpression(functionTSNode)
86-
? util.getContextualType(checker, functionTSNode)
87-
: services.getTypeAtLocation(functionNode);
86+
let functionType =
87+
ts.isFunctionExpression(functionTSNode) ||
88+
ts.isArrowFunction(functionTSNode)
89+
? util.getContextualType(checker, functionTSNode)
90+
: services.getTypeAtLocation(functionNode);
8891
if (!functionType) {
8992
functionType = services.getTypeAtLocation(functionNode);
9093
}

packages/type-utils/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"@typescript-eslint/typescript-estree": "5.52.0",
4343
"@typescript-eslint/utils": "5.52.0",
4444
"debug": "^4.3.4",
45-
"ts-api-utils": "^0.0.21"
45+
"ts-api-utils": "^0.0.22"
4646
},
4747
"devDependencies": {
4848
"@typescript-eslint/parser": "5.52.0",

packages/type-utils/src/getContextualType.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import * as tools from 'ts-api-utils';
21
import * as ts from 'typescript';
32

43
/**
@@ -23,7 +22,7 @@ export function getContextualType(
2322
} else if (
2423
ts.isVariableDeclaration(parent) ||
2524
ts.isPropertyDeclaration(parent) ||
26-
tools.isParameterDeclaration(parent)
25+
ts.isParameter(parent)
2726
) {
2827
return parent.type ? checker.getTypeFromTypeNode(parent.type) : undefined;
2928
} else if (ts.isJsxExpression(parent)) {

packages/typescript-estree/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"globby": "^11.1.0",
4949
"is-glob": "^4.0.3",
5050
"semver": "^7.3.7",
51-
"ts-api-utils": "^0.0.21"
51+
"ts-api-utils": "^0.0.22"
5252
},
5353
"devDependencies": {
5454
"@babel/code-frame": "*",

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13714,10 +13714,10 @@ trough@^1.0.0:
1371413714
resolved "https://registry.yarnpkg.com/trough/-/trough-1.0.5.tgz#b8b639cefad7d0bb2abd37d433ff8293efa5f406"
1371513715
integrity sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA==
1371613716

13717-
ts-api-utils@^0.0.21:
13718-
version "0.0.21"
13719-
resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-0.0.21.tgz#d5e58e3200f848123a89f3987d6ee9b613642d01"
13720-
integrity sha512-Dr9RHp5+4jLF+2wARhwQO1Z/6BFVsKigZhascnbsbyzSEDKO9qGlN7RgsquqHwP0lHiQmLJFYiGCLXTmcDC9Wg==
13717+
ts-api-utils@^0.0.22:
13718+
version "0.0.22"
13719+
resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-0.0.22.tgz#c58aac346f3990e6e164b4907aca57f54d81a2e8"
13720+
integrity sha512-XrQNMP/CQk2gOa+NfNIxNSf60n+RsC7tAkyCxhwnkShxUFpitvwNDfDxdMIZxHtdKKqqeRi94T191sNN7pFSrg==
1372113721

1372213722
ts-essentials@^2.0.3:
1372313723
version "2.0.12"

0 commit comments

Comments
 (0)