Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add typings #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

fletcherist
Copy link

heya i added typescript typings to use it in here as default rendering engine

@fletcherist
Copy link
Author

pls take a look @vitalets

type: "BigImage";
image_id?: string;
title?: string;
descriptions?: string;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
descriptions?: string;
description?: string;

items: Array<string | Button>,
defaults?: Button
): Button[];
declare function audio(name: string): void;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Эта штука возвращает объект с одним полем tts. Думаю, можно сделать тип ResponseTts и все функции влияющие на аудио-часть (audio(), effect(), pause(), tts()) будут возвращать его.
По аналогии можно сделать ResponseText для text(), br().

two: string,
five: string
): void;
declare function enumerate(list: any[]): void;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Возвращает строку

): void;
declare function enumerate(list: any[]): void;

declare function userify(userId: string, target: typeof reply): typeof reply;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

target здесь это функция

declare function enumerate(list: any[]): void;

declare function userify(userId: string, target: typeof reply): typeof reply;
declare function userify(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Мне кажется, эту функцию можно одной декларацией описать через дженерик. Она всегда возвращает тип, который у target. Только вот по синтаксису как это описать в ts не знаю.

seconds?: number;
leading: boolean;
},
response: any
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

по идее здесь передается Response, только без end_session.

button?: Button;
}
): {
type: "BigImage";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

завести BigImageCard, чтобы не дублировать это описание?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants