Created
July 30, 2019 12:23
-
-
Save staskuban/4578dded1955f599e2c27da57bf2bf43 to your computer and use it in GitHub Desktop.
ts вопросы к собеседованию
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
1) в каких случаях будет возвращен []? | |
export interface Interface { | |
title: string; | |
data: Array<string>; | |
id: string; | |
} | |
function foo(str:string) { | |
let arr = JSON.parse(str); | |
if (!(arr as Array<Interface>)) { | |
arr = []; | |
} | |
return arr | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment