1
0
Fork 0

doc/hacking.texi (TypeScript Migration): .d.ts reference

The original suggestion for interfaces (see diff) is much more
confusing.  We've found .d.ts files to work well for incremental migration.
master
Mike Gerwitz 2019-10-23 10:39:04 -04:00
parent fa80c79650
commit 8f7afd22e5
1 changed files with 10 additions and 7 deletions

View File

@ -341,14 +341,17 @@ If this is a concern,
in conjunction with ease.js'
@url{https://www.gnu.org/software/easejs/manual/easejs.html#Type-Checks-and-Polymorphism,@samp{Class.isA}}.
Interfaces do not exist at runtime in TypeScript,
but they do in easejs.
Consequently,
you can continue to export an ease.js interface while also exporting
a TypeScript interface.
Often times you will need to reference a class or interface as a
dependency before it has been migrated away from ease.js.
To do this,
continue to export using @samp{module.exports} rather than
TypeScript's @samp{export =}.
create a corresponding @code{.d.ts} file in the same directory
as the dependency.
For example,
if a class @code{Foo} is contained in @file{Foo.js},
create a sibling @file{Foo.d.ts} file.
For more information,
see @url{https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html,Declaration Files}
in the TypeScript handbook.
ease.js implements stackable Scala-like traits.
Traits are @emph{not} provided by TypeScript.