V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
rabbbit
V2EX  ›  问与答

[Sequelize and TypeScript]为什么方法返回值的类型都是 any?

  •  
  •   rabbbit · 2020-04-20 16:56:58 +08:00 · 610 次点击
    这是一个创建于 1970 天前的主题,其中的信息可能已经有所发展或是发生改变。

    代码

    !async function() {
      const sequelize = new Sequelize({
        dialect: 'sqlite',
        storage: path.join(process.cwd(), 'test.sqlite'),
        logging: false,
      });
      class Seq extends Model { }
      Seq.init({}, {sequelize, modelName: 'test'});
      await Seq.sync();
      const result = Seq.findAndCountAll({});
    }();
    

    F12 点进去看 findAndCountAll 方法有定义返回值的类型, 为什么 result 的类型变成 any 了?

    第 1 条附言  ·  2020-04-20 17:56:19 +08:00
    解决了...
    第 2 条附言  ·  2020-04-20 18:19:37 +08:00
    目前尚无回复
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   983 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 19:27 · PVG 03:27 · LAX 12:27 · JFK 15:27
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.