Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: bump ts-api-utils to v0.0.22 #6472

Merged
merged 1 commit into from Feb 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/eslint-plugin/package.json
Expand Up @@ -53,7 +53,7 @@
"natural-compare-lite": "^1.4.0",
"regexpp": "^3.2.0",
"semver": "^7.3.7",
"ts-api-utils": "^0.0.21"
"ts-api-utils": "^0.0.22"
},
"devDependencies": {
"@types/debug": "*",
Expand Down
9 changes: 6 additions & 3 deletions packages/eslint-plugin/src/rules/no-unsafe-return.ts
@@ -1,6 +1,7 @@
import type { TSESTree } from '@typescript-eslint/utils';
import { AST_NODE_TYPES } from '@typescript-eslint/utils';
import * as tools from 'ts-api-utils';
import * as ts from 'typescript';

import * as util from '../util';
import { getThisExpression } from '../util';
Expand Down Expand Up @@ -82,9 +83,11 @@ export default util.createRule({
// so we have to use the contextual typing in these cases, i.e.
// const foo1: () => Set<string> = () => new Set<any>();
// the return type of the arrow function is Set<any> even though the variable is typed as Set<string>
let functionType = tools.isExpression(functionTSNode)
? util.getContextualType(checker, functionTSNode)
: services.getTypeAtLocation(functionNode);
let functionType =
ts.isFunctionExpression(functionTSNode) ||
ts.isArrowFunction(functionTSNode)
? util.getContextualType(checker, functionTSNode)
: services.getTypeAtLocation(functionNode);
if (!functionType) {
functionType = services.getTypeAtLocation(functionNode);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/type-utils/package.json
Expand Up @@ -42,7 +42,7 @@
"@typescript-eslint/typescript-estree": "5.51.0",
"@typescript-eslint/utils": "5.51.0",
"debug": "^4.3.4",
"ts-api-utils": "^0.0.21"
"ts-api-utils": "^0.0.22"
},
"devDependencies": {
"@typescript-eslint/parser": "5.51.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/type-utils/src/getContextualType.ts
@@ -1,4 +1,3 @@
import * as tools from 'ts-api-utils';
import * as ts from 'typescript';

/**
Expand All @@ -23,7 +22,7 @@ export function getContextualType(
} else if (
ts.isVariableDeclaration(parent) ||
ts.isPropertyDeclaration(parent) ||
tools.isParameterDeclaration(parent)
ts.isParameter(parent)
) {
return parent.type ? checker.getTypeFromTypeNode(parent.type) : undefined;
} else if (ts.isJsxExpression(parent)) {
Expand Down
2 changes: 1 addition & 1 deletion packages/typescript-estree/package.json
Expand Up @@ -48,7 +48,7 @@
"globby": "^11.1.0",
"is-glob": "^4.0.3",
"semver": "^7.3.7",
"ts-api-utils": "^0.0.21"
"ts-api-utils": "^0.0.22"
},
"devDependencies": {
"@babel/code-frame": "*",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Expand Up @@ -13659,10 +13659,10 @@ trough@^1.0.0:
resolved "https://registry.yarnpkg.com/trough/-/trough-1.0.5.tgz#b8b639cefad7d0bb2abd37d433ff8293efa5f406"
integrity sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA==

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

ts-essentials@^2.0.3:
version "2.0.12"
Expand Down