Today, I cloned a repo that is using tsoa. While running tsoa routes I came across the following errors:
(node:2836) UnhandledPromiseRejectionWarning: TypeError: ts.formatting.RulesProvider is not a constructor
at getRuleProvider (/usr/local/lib/node_modules/tsoa/node_modules/typescript-formatter/lib/formatter.js:19:28)
at Object.format [as default] (/usr/local/lib/node_modules/tsoa/node_modules/typescript-formatter/lib/formatter.js:13:58)
at /usr/local/lib/node_modules/tsoa/node_modules/typescript-formatter/lib/index.js:118:48
at <anonymous>
(node:2836) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:2836) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:2846) UnhandledPromiseRejectionWarning: TypeError: ts.formatting.RulesProvider is not a constructor
at getRuleProvider (/usr/local/lib/node_modules/tsoa/node_modules/typescript-formatter/lib/formatter.js:19:28)
at Object.format [as default] (/usr/local/lib/node_modules/tsoa/node_modules/typescript-formatter/lib/formatter.js:13:58)
at /usr/local/lib/node_modules/tsoa/node_modules/typescript-formatter/lib/index.js:118:48
at <anonymous>
(node:2846) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:2846) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
First I thought it is related to MacOS because it is working for me on another Linux machine (i.e. Ubuntu). After digging into the errors a little bit, it seems to me that it is because of the latest version of TypeScript 2.7.1 which was released yesterday: In this release they removed the RulesProvider class completely from the typescript.js.
Can anyone comment?
@AmirMaurice I am having the same problem on Windows (just because you were thinking it might be related).
I can also confirm having found the issue of the missing/moved RulesProvider class inside the main typescript.js. However I think this issue rather belongs to the typescript-formatter project.
I spent almost 8 hours, up till now, not work, dont know why!
My quick fix is to fork & build tsoa with latest Typescript 2.7.1 & formatter.
If anyone need that fix while waiting for official release from tsoa, please refer to my git package by running following 2 commands at your node module:
npm uninstall tsoa
npm install thanhptr/tsoa
Thanks all, let me look into getting things updated to 2.7.1 ASAP.
Good to see, I'm not the only one with that problem. For now i solved it by using TypeScript 2.6.2.
Any updates when it will be fixed?
Any Progress? Do you guys need help?
I fixed it.
https://github.com/lukeautry/tsoa/pull/191
A test is broken (please fix this).
@lukeautry can you please push this to npm asap?
Thx.
Issue should be fixed in 2.1.0 - please let me know if you're still having trouble.
Most helpful comment
Issue should be fixed in 2.1.0 - please let me know if you're still having trouble.