Browse Source

11.6: creating d.ts files.

Frederic G. MARAND 5 years ago
parent
commit
693a71dd79
5 changed files with 7 additions and 6 deletions
  1. 2 2
      app/classes.ts
  2. 2 2
      app/interfaces.ts
  3. 1 1
      app/shelf.ts
  4. 1 0
      app/tsconfig.json
  5. 1 1
      doc/modules.md

+ 2 - 2
app/classes.ts

@@ -11,7 +11,7 @@ class UniversityLibrarian implements I.Librarian {
   }
 }
 
-abstract class ReferenceItem {
+export abstract class ReferenceItem {
   static department = 'Research';
   private _publisher: string;
 
@@ -63,4 +63,4 @@ class Catalog<T extends CatalogItem> implements Inventory<T> {
 
 }
 
-export { Catalog, Journal, ReferenceItem, UniversityLibrarian };
+export { Catalog, Journal, UniversityLibrarian };

+ 2 - 2
app/interfaces.ts

@@ -18,7 +18,7 @@ interface CatalogItem {
   catalogNumber: number;
 }
 
-interface DamageLogger {
+export interface DamageLogger {
   (reason: string): void;
 }
 
@@ -38,7 +38,7 @@ interface Magazine {
   title: string;
 }
 
-interface Person {
+export interface Person {
   email: string;
   name: string;
 }

+ 1 - 1
app/shelf.ts

@@ -1,4 +1,4 @@
-interface ShelfItem {
+export interface ShelfItem {
   title: string;
 }
 

+ 1 - 0
app/tsconfig.json

@@ -3,6 +3,7 @@
   // "extends": "./tsconfig.base.json",
 
   "compilerOptions": {
+    "declaration": true,
     "module": "commonjs",
     "outDir": "../js",
     "pretty": true,

+ 1 - 1
doc/modules.md

@@ -35,7 +35,7 @@
 # Résolution des modules dans TS 2.2.x
 
 Apparemment pas tout à fait correcte: il y a aussi utilisation de 
-`node_modules/@types` pour les imports sans chemin.
+`node_modules/@types` pour les imports sans chemin. Apparemment, c'est un changement quelque part entre 1.6.x et 2.2.x : en 2018, on n'utilise plus `tsd` ni `typings` mais les composants `@types/(package)`, installés par `npm`/`yarn`.
 
 https://www.typescriptlang.org/docs/handbook/tsconfig-json.html#types-typeroots-and-types