aurelia - need guidance on strategy for creating typescript public type definitions -


i seeking guidance on creating public type definitions aurelia framework - aurelia on github here / aurelia website here / aurelia typescript samples on github

i struggling following pattern:

repository pattern

typescript compiler wont allow export declaration in ambient external module declaration references external module through relative external module name

the repos use systemjs , jspm resolve aurelia-metadata. want use ambient module declarations expose types aurelia-metadata

what i'm trying achieve same copying contents of origin.d.ts, resource-type.d.ts, , metadata.d.ts ambient module declaration in aurelia.d.ts.

note ./metadata/index.js publishes public interface through exports, , precisely want expose in ambient module declaration

i surrender , manually copy info compiler-generated origin.d.ts, resource-type.d.ts, , metadata.d.ts ambient module declaration, have been trying find way expose exported in index.d.ts, public api module in repo.

the issue manual approach there 20+ libraries, continue grow, , if updating api can't done using compiler, forever tracking changes in repos , updating api manually.

i believe public api each repo must ambient module because actual path corresponding import (aurelia-metadata in case) resolved using systemjs loader (the module dependencies managed using jspm)

assuming have origin.d.ts:

declare module 'aurelia/origin' {     export class origin {     } } 

you can import / reexport aurelia.d.ts:

/// <reference path="./origin/origin.d.ts"/> declare module 'aurelia' {     export * 'aurelia/origin'; } 

verified usage:

/// <reference path="./aurelia"/>  import {origin origin1} "aurelia/origin"; import {origin origin2} "aurelia"; 

note: exact answer depend on how want use definitions in typescript.

tracked here : https://github.com/microsoft/typescript/issues/2516#issuecomment-87509666


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -