Last active
May 8, 2021 17:56
-
-
Save alexbaumgertner/10fedeaa14b6847f371127850b2d93f9 to your computer and use it in GitHub Desktop.
Revisions
-
alexbaumgertner revised this gist
May 8, 2021 . No changes.There are no files selected for viewing
-
alexbaumgertner revised this gist
May 8, 2021 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -44,3 +44,9 @@ const appPage = new AppPage( ) appPage.page // WebStrom AppPage<lang.en>.page(): Page<T> // VSCode AppPage<lang.en>.page: Page<lang.en> -
alexbaumgertner created this gist
May 8, 2021 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ interface Page<T> { title: string; content: string; lang: T; } function getPage<T> ( title: string, content: string, lang: T, ): Page<T> { return { title, content, lang, } } class AppPage<T> { constructor ( private title: string, private content: string, private lang: T, ) {} public get page () { return getPage( this.title, this.content, this.lang, ) } } enum lang { ru = 'ru', en = 'en', } const appPage = new AppPage( 'App', 'Hello, World!', lang.en as const, ) appPage.page