rabbbit
V2EX  ›  问与答

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

  •  
  •   rabbbit · Apr 20, 2020 · 811 views
    This topic created in 2223 days ago, the information mentioned may be changed or developed.

    代码

    !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 了?

    Supplement 1  ·  Apr 20, 2020
    解决了...
    Supplement 2  ·  Apr 20, 2020
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2496 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 00:50 · PVG 08:50 · LAX 17:50 · JFK 20:50
    ♥ Do have faith in what you're doing.