How can i compile a file containing different libraries (e.g. jquery, jquery-ui, other 3rd party libs) with typescript

笑着哭i 提交于 2019-12-12 06:59:36

问题


I am working on a project that contains multiple libraries (Jquery, jq-ui, fileupload plugins and some other 3rd party plugins) i am converting my project to typescript but in order to work with those libraries I need a .d.ts file to include in my project but when i compile my plugins.ts (just rename from .js to .ts) it give me a bunch of errors and generate a .js file but no .d.ts file and i cannot compile my other files as i need to include a reference of my plugin file

is there any kind of -force type flag in tsc or is their a way to compile my file.

I use this command to compile my ts file tsc --declaration bmkjqplugins.ts


回答1:


is there any kind of -force type flag in tsc or is their a way to compile my file.

No. You need to reference those files for complete type safety. That said : typescript will generate valid JavaScript in the presence of TYPEONLY errors.

Note: grunt-TS does support not failing on type errors : https://github.com/TypeStrong/grunt-ts#grunt-ts-gruntfilejs-options



来源:https://stackoverflow.com/questions/27328383/how-can-i-compile-a-file-containing-different-libraries-e-g-jquery-jquery-ui

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!