@ Types/Sequelize错误TS1086:无法在环境上下文中声明访问器 [英] @Types/Sequelize Error TS1086: An accessor cannot be declared in ambient context

查看:1233
本文介绍了@ Types/Sequelize错误TS1086:无法在环境上下文中声明访问器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目在运行'tsc'时显示此错误:

I have a project that shows this error when I run 'tsc':

../modules/node_modules/sequelize/types/lib/transaction.d.ts:33:14 - error TS1086: An accessor cannot be declared in an ambient context.

33   static get LOCK(): LOCK;
                ~~~~

../modules/node_modules/sequelize/types/lib/transaction.d.ts:40:7 - error TS1086: An accessor cannot be declared in an ambient context.

40   get LOCK(): LOCK;
         ~~~~

我的版本是:

  • "@ types/sequelize":"^ 4.28.6"
  • 续集":"^ 5.8.10"
  • "sequelize-typescript":"1.0.0-beta.4"

该项目在nodemon上正常工作,但是在尝试编译打字稿时失败.有人知道这个错误吗?

The project works fine with nodemon but fails when I try to compile the typescript. Anyone knows this error?

谢谢.

推荐答案

您需要使用打字稿3.7.

you need to use typescript 3.7.

摘自Typescript 3.7发行说明:

To detect the issue around accessors, TypeScript 3.7 will now emit get/set accessors in .d.ts files so that in TypeScript can check for overridden accessors.

据推测sequelize是用打字稿3.7编译的,并发出以前版本不理解的定义文件.因此,您需要升级到打字稿3.7或使用早期版本的sequelize.

so presumably sequelize was compiled with typescript 3.7 and emits definition files that previous versions don't understand. So you'll need to upgrade to typescript 3.7 or use an earlier version of sequelize.

这篇关于@ Types/Sequelize错误TS1086:无法在环境上下文中声明访问器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆