I'm working on a library where I write code in es6
and transpile it down to es5
. When trying to test the output es5
code, the IDE is not able to give me hints of function arguments. It only seems to know that I have exported a function named foo
. I have tried this on both vs code
and Webstorm
. I have seen that many other libraries I have used give hints of function parameters. I have exported functions provided by my library on my library entry file - index.js
. The entry file looks like this:
import {
foo,
} from "./utils";
export {
foo
};
The output looks like this:
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "foo", {
enumerable: true,
get: function get() {
return _calculate.default;
}
});
var _calculate = _interopRequireDefault(require("./calculate"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
I use babel to transpile like this:
$ babel -d lib src/
What can I do to get the transpiled code to provide the user with parameter hints?
If you are using NetBeans IDE you can use L_CTRL+SPACE.. This will open what is available with the libraries you are using. Let's say I use THREE.js; I can type:
THREE.B L_CTRL+SPACE
and would return this
Also if you want to provide documentation about a function you can use JavaDoc Coments like this:
/**
* Author : prisoner849
* https://jsfiddle.net/prisoner849/8hqy99jj/
* @param {type} geometry
* @param {type} independent
* @returns {GridBoxGeometry.newGeometry|THREE.BoxBufferGeometry}
*/
function GridBoxGeometry(geometry, independent) {
....
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.