Skip to content

Instantly share code, notes, and snippets.

View novitckas's full-sized avatar
🌊

Stanislav Novitckas novitckas

🌊
  • Selectel
  • Saint-Petersburg
View GitHub Profile
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;
}
interface IShaverma {
name: string,
type: 'v_lavashe' | 'na_tarelke'
}
const myShaverma: WithAnyFields<IShaverma> = {
name: 'classic',
type: 'v_lavashe',
isSpicy: true,
size: 'xxl'
};
type WithAnyFields<T> = T & {[key:string]:any;}
const myShaverma: IShaverma = {
name: 'classic',
// Ошибка! Не хватает свойства 'type'
isSpicy: true,
size: 'xxl'
}
const myShaverma: IShaverma = {
name: 'classic',
type: 'v_lavashe',
isSpicy: true,
size: 'xxl'
}
interface IShaverma {
name: string,
type: 'v_lavashe' | 'na_tarelke',
[key:string]:any;
}
if (tokens.some((token) => stringsInWords[stringNumber].includes(token))) {
}
if (entities[0].type === 'YANDEX.NUMBER') {
}
{
"response": {
"buttons": [
{
"title": "6",
"hide": true
},
{
"title": "5",
response.card = {
type: 'BigImage',
image_id: "213044/7d8cccdaf95f08517da9",
title: "Играю струну номер 2" // Текст, который выведется вместе с картинкой
}