Skip to content

Instantly share code, notes, and snippets.

@atrunelle
Created June 26, 2018 15:11
Show Gist options
  • Save atrunelle/ecb9a0f941e88c5d78b7d7ec59ca8c04 to your computer and use it in GitHub Desktop.
Save atrunelle/ecb9a0f941e88c5d78b7d7ec59ca8c04 to your computer and use it in GitHub Desktop.
Typescript interface and readability
export interface IAnswer {
answer: string;
description: string;
}
export interface IFunFact {
text: string;
number: number | string;
}
export interface IQuestion {
text: string;
answer: IAnswer;
funFact: IFunFact;
}
const question: IQuestion = {
text: 'Do you eat chocolate?',
answer: {
answer: 'yes',
description: ''.
},
funFact: {
number: '100%'
text: 'replied yes',
}
};
function getAnswer(question: IQuestion): IAnwser {
return question.answer;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment