Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
129 views
in Technique[技术] by (71.8m points)

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

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...