Skip to content

Instantly share code, notes, and snippets.

@ksaldana1
Last active January 30, 2019 05:39
Show Gist options
  • Save ksaldana1/d10d5a3c54147550d54a50fec161dfbd to your computer and use it in GitHub Desktop.
Save ksaldana1/d10d5a3c54147550d54a50fec161dfbd to your computer and use it in GitHub Desktop.
transform-input-output
// input
export namespace protos { // ModuleDeclaration
export namespace user { // ModuleDeclaration
// Module Block
export interface User { // InterfaceDeclaration
username: string; // username: string is PropertySignature
info: protos.Info.User; // TypeReference
}
}
export namespace Info {
export interface User {
name: protos.Info.Name; // TypeReference
}
export interface Name {
firstName: string;
lastName: string;
}
}
}
// this line is a TypeAliasDeclaration
export type User = protos.user.User; // protos.user.User is a TypeReference
// output
export interface User {
username: string;
info: { // info: { .. } is a TypeLiteral
name: { // name: { .. } is a TypeLiteral
firstName: string;
lastName: string;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment