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
parent
fa80c79650
commit
8f7afd22e5
|
@ -341,14 +341,17 @@ If this is a concern,
|
||||||
in conjunction with ease.js'
|
in conjunction with ease.js'
|
||||||
@url{https://www.gnu.org/software/easejs/manual/easejs.html#Type-Checks-and-Polymorphism,@samp{Class.isA}}.
|
@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,
|
Often times you will need to reference a class or interface as a
|
||||||
but they do in easejs.
|
dependency before it has been migrated away from ease.js.
|
||||||
Consequently,
|
|
||||||
you can continue to export an ease.js interface while also exporting
|
|
||||||
a TypeScript interface.
|
|
||||||
To do this,
|
To do this,
|
||||||
continue to export using @samp{module.exports} rather than
|
create a corresponding @code{.d.ts} file in the same directory
|
||||||
TypeScript's @samp{export =}.
|
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.
|
ease.js implements stackable Scala-like traits.
|
||||||
Traits are @emph{not} provided by TypeScript.
|
Traits are @emph{not} provided by TypeScript.
|
||||||
|
|
Loading…
Reference in New Issue