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 characters
const getMemoizationSum = () => { | |
const cache = new Map(); | |
return (a, b) => { | |
const cacheKey = `${a}+${b}`; | |
const cachedValue = cache.get(cacheKey); | |
if (cachedValue) { | |
console.log('cached') | |
return cachedValue; | |
} |
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 characters
interface IShaverma { | |
name: string, | |
type: 'v_lavashe' | 'na_tarelke' | |
} | |
const myShaverma: WithAnyFields<IShaverma> = { | |
name: 'classic', | |
type: 'v_lavashe', | |
isSpicy: true, | |
size: 'xxl' | |
}; |
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 characters
type WithAnyFields<T> = T & {[key:string]:any;} |
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 characters
const myShaverma: IShaverma = { | |
name: 'classic', | |
// Ошибка! Не хватает свойства 'type' | |
isSpicy: true, | |
size: 'xxl' | |
} |
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 characters
const myShaverma: IShaverma = { | |
name: 'classic', | |
type: 'v_lavashe', | |
isSpicy: true, | |
size: 'xxl' | |
} |
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 characters
interface IShaverma { | |
name: string, | |
type: 'v_lavashe' | 'na_tarelke', | |
[key:string]:any; | |
} |
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 characters
if (tokens.some((token) => stringsInWords[stringNumber].includes(token))) { | |
} |
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 characters
if (entities[0].type === 'YANDEX.NUMBER') { | |
} |
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 characters
response.card = { | |
type: 'BigImage', | |
image_id: "213044/7d8cccdaf95f08517da9", | |
title: "Играю струну номер 2" // Текст, который выведется вместе с картинкой | |
} |
NewerOlder