Typescript 导出未定义变量时如何捕获隐式any?

Typescript 导出未定义变量时如何捕获隐式any?,typescript,eslint,typescript-eslint,Typescript,Eslint,Typescript Eslint,在typescript中,可以不指定变量的类型,让流分析完成其工作: let x; // x: any x = 5; x.toFixed(2); // ok, x is deduced to be number function f() { x; } // not ok, flow analysis can't know, implicit any 但是,当错误导出变量时,不会触发implicit any: let x; export { x }; //other file import {

在typescript中,可以不指定变量的类型,让流分析完成其工作:

let x; // x: any
x = 5;
x.toFixed(2); // ok, x is deduced to be number
function f() { x; } // not ok, flow analysis can't know, implicit any
但是,当错误导出变量时,不会触发implicit any:

let x;
export { x };
//other file
import { x } from './above';
x.plzDont(); // completely fine
// (though thankfully caught by some other linter rules in my case)
  • 为什么决定不将其归类为“隐含任何”?在我看来,这是“含蓄的”
  • 我怎样才能自动发现这个问题?我找不到任何支持@typescript eslint规则的方法,也不知道其他检测方法

附言:我不想要任何
any
,除非我明确地写
any
,即使这样,我通常也不想要

PPS:我也觉得有点奇怪,ex-和导入
let
变量,没有分配它,不会抛出(至少在使用esm的节点中是这样),但这只是一个注释