Skip to content

Instantly share code, notes, and snippets.

@Pyrolistical
Created May 8, 2017 21:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pyrolistical/f6d5acf7746203aadb46e905de5b8054 to your computer and use it in GitHub Desktop.
Save Pyrolistical/f6d5acf7746203aadb46e905de5b8054 to your computer and use it in GitHub Desktop.
typescript checkJs + node
export interface AnotherfileStatic {
validfunction(greeting: string);
}
declare const Anotherfile: AnotherfileStatic;
export default Anotherfile;
module.exports = {
validfunction(greeting) {
console.log(greeting);
}
};
const anotherfile = require('./anotherfile');
anotherfile.validfunction('hello');
{
"name": "tstest",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"@types/node": "7.0.18",
"typescript": "2.3.2"
}
}
{
"compilerOptions": {
"noEmit": true,
"module": "commonjs",
"allowJs": true,
"checkJs": true,
"target": "es6",
"types": [
"node"
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment