本文整理汇总了TypeScript中tcomb.struct函数的典型用法代码示例。如果您正苦于以下问题:TypeScript struct函数的具体用法?TypeScript struct怎么用?TypeScript struct使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了struct函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1:
const BaseInlineQuery = function <T>(props: any, name: string = 'Unknown') {
return t.struct<T>(
Object.assign(
{},
{
type: t.String,
id: t.String,
reply_markup: t.maybe(k.InlineKeyboardMarkup),
input_message_content: t.maybe(InputMessageContent)
},
props),
name)
}
开发者ID:goodmind,项目名称:cycle-telegram,代码行数:13,代码来源:inline-types.ts
示例2:
import * as t from 'tcomb'
import * as m from './multimedia-types'
export const InputFile = t.Any
export interface TcombInputFile {}
export const User = t.struct<TcombUser>({
id: t.Number,
first_name: t.String,
last_name: t.maybe(t.String),
username: t.maybe(t.String)
})
export interface TcombUser {
id: number
first_name: string
last_name?: string
username?: string
}
export const ChatMember = t.struct<TcombChatMember>({
user: User,
status: t.enums.of([
'creator',
'administrator',
'member',
'left',
'kicked'
])
})
export interface TcombChatMember {
user: TcombUser,
开发者ID:goodmind,项目名称:cycle-telegram,代码行数:31,代码来源:types.ts
示例3:
import * as t from 'tcomb'
import { TcombCallbackGame, CallbackGame } from './types'
export const KeyboardButton = t.struct<TcombKeyboardButton>({
text: t.String,
request_contact: t.maybe(t.Boolean),
request_location: t.maybe(t.Boolean)
})
export interface TcombKeyboardButton {
text: string
request_contact?: boolean
request_location?: boolean
}
export const ReplyKeyboardMarkup = t.struct<TcombReplyKeyboardMarkup>({
keyboard: t.list(t.list(KeyboardButton)),
resize_keyboard: t.maybe(t.Boolean),
one_time_keyboard: t.maybe(t.Boolean),
selective: t.maybe(t.Boolean)
})
export interface TcombReplyKeyboardMarkup {
keyboard: TcombKeyboardButton[][]
resize_keyboard?: boolean
one_time_keyboard?: boolean
selective?: boolean
}
export const ReplyKeyboardRemove = t.struct<TcombReplyKeyboardRemove>({
hide_keyboard: t.Boolean,
selective: t.maybe(t.Boolean)
})
开发者ID:goodmind,项目名称:cycle-telegram,代码行数:31,代码来源:keyboard-types.ts
示例4: expect
expect(() => stateInit(t.struct({}))).toThrow();
开发者ID:buildo,项目名称:state,代码行数:1,代码来源:index.test.ts
示例5:
import * as t from 'tcomb'
export const PhotoSize = t.struct<TcombPhotoSize>({
file_id: t.String,
width: t.Number,
height: t.Number,
file_size: t.maybe(t.Number)
})
export interface TcombPhotoSize {
file_id: string
width: number
height: number
file_size?: number
}
export const Audio = t.struct<TcombAudio>({
file_id: t.String,
duration: t.Number,
performer: t.maybe(t.String),
title: t.maybe(t.String),
mime_type: t.maybe(t.String),
file_size: t.maybe(t.Number)
})
export interface TcombAudio {
file_id: string
duration: number
performer?: string
title: string
mime_type?: string
file_size?: number
}
开发者ID:goodmind,项目名称:cycle-telegram,代码行数:31,代码来源:multimedia-types.ts
注:本文中的tcomb.struct函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论