Skip to content

Commit

Permalink
Fix #139 by ambient module definition for NPM packages without versio…
Browse files Browse the repository at this point in the history
…n number
  • Loading branch information
JumpLink committed Nov 16, 2023
1 parent a77864e commit 1e1580c
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<%#
This EJS template is used for the generated .d.ts files for ambient typescript module support.
See https://www.typescriptlang.org/docs/handbook/modules.html#ambient-modules
%>
// This EJS template is used for the generated .d.ts files for ambient typescript module support.
// See https://www.typescriptlang.org/docs/handbook/modules.html#ambient-modules
_%>
<%_ const pkg = dep.get(girModule.namespace, girModule.version) _%>
<%_ let moduleImportStr = ""; _%>
<%_ if(package){ _%>
Expand All @@ -23,7 +23,8 @@ declare module 'gi://<%= name %>?version=<%= version %>' {
export default <%- girModule.importNamespace -%>;
}

<%_ if(!dep.hasConflict(name, version)){ _%>
<%# // Generate ambient module declarations Without version number if there are no conflicts or the target is an NPM package _%>
<%_ if(package || !dep.hasConflict(name, version)){ _%>
declare module 'gi://<%= name %>' {
<%- moduleImportStr %>;
export default <%- girModule.importNamespace -%>;
Expand Down

0 comments on commit 1e1580c

Please sign in to comment.