Skip to content

Commit

Permalink
add desired-output-jsdoc.js which tsc can process
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmicexplorer committed Nov 4, 2024
1 parent 7a55115 commit b005ca2
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 12 deletions.
41 changes: 41 additions & 0 deletions desired-output-jsdoc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* @type {(x: number) => number}
*/
var f;

/**
* @type {{a: number}}
*/
var x;

/**
* @type {({a}: {a: string}) => string}
*/
var g;

/**
* @type {({a, b, c, e}: {a: number, b?: number, c: {d?: number}, e: [f: number]}) => number}
*/
var h;

f = function(x) {
return x + 3;
};

x = {
a: 3
};

g = function({
a: x
}) {
return x;
};

console.log(g({a: "asdf"}));

h = function({a, b = 3, c: {d = 3}, e: [f]}) {
return a + b + d + f;
};

console.log(h({a: 3, c: {}, e: [5]}));
12 changes: 0 additions & 12 deletions desired-output.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ jsdoc:
* /
var f;
/**
* @param {number} x
* @returns {number}
* /
f = function(x) {
return x + 3;
}
Expand Down Expand Up @@ -55,10 +51,6 @@ jsdoc:
* /
var g;
/**
* @param {{a: string}} _
* @returns {string}
* /
g = function({a: x}) {
return x;
}
Expand All @@ -83,10 +75,6 @@ jsdoc:
* /
var h;
/**
* @param {{a: number, b?: number, c: {d?: number}, e: [f: number]}} _
* @returns number
* /
h = function({a, b = 3, c: {d = 3}, e: [f]}) {
return a + b + d;
};
Expand Down

0 comments on commit b005ca2

Please sign in to comment.