当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript tcomb.list函数代码示例

本文整理汇总了TypeScript中tcomb.list函数的典型用法代码示例。如果您正苦于以下问题:TypeScript list函数的具体用法?TypeScript list怎么用?TypeScript list使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了list函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1:

 okTake<TcombChatMember[]>(t, sources, (chatMembers) => {
   t.ok(tc.list(ChatMember).is(tc.list(ChatMember)(chatMembers)), 'chat members satisfies typecheck')
   chatMembers.forEach((chatMember: any) => {
     t.ok(chatMember.hasOwnProperty('user'), 'chat member has property user')
     t.ok(chatMember.hasOwnProperty('status'), 'chat member has property status')
   })
   t.end()
 })
开发者ID:goodmind,项目名称:cycle-telegram,代码行数:8,代码来源:most.ts

示例2:

export const GameHighScore = t.struct<TcombGameHighScore>({
  position: t.Number,
  user: User,
  score: t.Number
})
export interface TcombGameHighScore {
  position: number
  user: TcombUser
  score: number
}

export const Game = t.struct<TcombGame>({
  title: t.String,
  description: t.String,
  photo: t.list(m.PhotoSize),
  text: t.maybe(t.String),
  text_entities: t.maybe(t.list(MessageEntity)),
  animation: t.maybe(m.Animation)
})
export interface TcombGame {
  title: string
  description: string
  photo: m.TcombPhotoSize[],
  text?: string
  text_entities?: TcombMessageEntity[],
  animation?: m.TcombAnimation
}

export const Message = t.declare<TcombMessage>('Message')
Message.define(t.struct({
开发者ID:goodmind,项目名称:cycle-telegram,代码行数:30,代码来源: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:

export const Venue = t.struct<TcombVenue>({
  location: Location,
  title: t.String,
  address: t.String,
  foursquare_id: t.maybe(t.String)
})
export interface TcombVenue {
  location: TcombLocation
  title: string
  address: string
  foursquare_id?: string
}

export const UserProfilePhotos = t.struct<TcombUserProfilePhotos>({
  total_count: t.Number,
  photos: t.list(t.list(PhotoSize))
})
export interface TcombUserProfilePhotos {
  total_count: number
  photos: TcombPhotoSize[][]
}

export const File = t.struct<TcombFile>({
  file_id: t.String,
  file_size: t.maybe(t.Number),
  file_path: t.maybe(t.String)
})
export interface TcombFile {
  file_id: string
  file_size?: number
  file_path?: string
开发者ID:goodmind,项目名称:cycle-telegram,代码行数:31,代码来源:multimedia-types.ts


注:本文中的tcomb.list函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。