當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。