typescript: What to do if a typings (or tsd) is not available? -
i looking on typescript handbook , can't seem find answer.
if using library no typings exist options.
one create typings file, don't want do.
what other options, seem remember kind of 'declare' keyword ?
or maybe in tsconfig ?
i assume there way of declaring variable (type) globally every time use it, work.
and presume there way of declaring available in 1 file.
i still confused this.
of course best way include typings file won't available.
any appreciated
thanks
if primary concern rid of errors, can write declare var myuntypedlibrary: any;
above code, myuntypedlibrary name of global reference dependency.
if need reference in several files , don't want repeat yourself, write in top of file, above namespaces, , available whole project. if have many untyped dependencies, idea have separate ts-file define these.
note: works fine when using local modules. i'd guess might more troublesome if 1 using external modules , want have 1 place define implicit dependency them all, again each module should handle own dependencies internally anyway.
Comments
Post a Comment