$ npx -p https://gist.github.com/vvakame/4d882bb3f611c8c14ab86c5d18d8a9eb run-tsc
Last active
July 12, 2017 01:31
-
-
Save vvakame/4d882bb3f611c8c14ab86c5d18d8a9eb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package-lock.json | |
node_modules/ | |
*.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "4d882bb3f611c8c14ab86c5d18d8a9eb", | |
"version": "1.0.0", | |
"private": true, | |
"description": "npx example", | |
"bin": { | |
"run-tsc": "run.sh" | |
}, | |
"repository": { | |
"type": "git", | |
"url": "git+https://gist.github.com/4d882bb3f611c8c14ab86c5d18d8a9eb.git" | |
}, | |
"keywords": [], | |
"author": "vvakame", | |
"license": "MIT", | |
"bugs": { | |
"url": "https://gist.github.com/4d882bb3f611c8c14ab86c5d18d8a9eb" | |
}, | |
"homepage": "https://gist.github.com/4d882bb3f611c8c14ab86c5d18d8a9eb", | |
"devDependencies": { | |
"typescript": "2.4.1" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Named { | |
name: string; | |
} | |
function parrot<T extends Named>(obj: T): T { | |
return obj; | |
} | |
// A | |
parrot({ | |
name: "TypeScript", | |
}); | |
// B | |
parrot({ | |
name: "TypeScript", | |
age: 5, | |
}); | |
// C | |
parrot({ | |
name: "TypeScript", | |
age: function () { }, | |
}); | |
// D | |
parrot({ | |
name: "TypeScript", | |
sayHello() { | |
console.log(`Hello, ${this.name}`); | |
}, | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash -eux | |
cd $(dirname $0) | |
cd $(dirname $(readlink $0)) | |
tsc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"compilerOptions": { | |
"target": "es5", | |
"module": "commonjs", | |
"strict": true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment