Skip to content

Instantly share code, notes, and snippets.

@rolaveric
Last active August 29, 2015 14:08
Show Gist options
  • Save rolaveric/8e9769f20093ceda444d to your computer and use it in GitHub Desktop.
Save rolaveric/8e9769f20093ceda444d to your computer and use it in GitHub Desktop.
Type syntax from TypeScript
// TypeScript types
function myFn(name:string, obj:MyClass) {
// ...
}
// Equivalent ES5
/**
* @param name {string}
* @param obj {MyClass}
*/
function myFn(name, obj) {
assert(typeof name === 'string');
assert(obj instanceof MyClass);
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment