首页 > 其他分享 >type ColumnTypes = Exclude<EditableTableProps["columns"], undefined>; 这是什么意思

type ColumnTypes = Exclude<EditableTableProps["columns"], undefined>; 这是什么意思

时间:2024-02-21 14:44:07浏览次数:31  
标签:Column EditableTableProps ColumnTypes 类型 Exclude type columns

在TypeScript中,Exclude<T, U> 是一个内置的类型操作符,它的作用是从联合类型 T 中排除那些与类型 U 相匹配的类型。

这里的 EditableTableProps["columns"] 表示从 EditableTableProps 这个接口或类型中提取 columns 属性的类型。

假设 EditableTableProps 定义如下:

interface EditableTableProps {
  columns?: Column[]; // 假设 Column 是某种类型
  // 其他属性...
}

在这种情况下,EditableTableProps["columns"] 的类型可能是 Column[] | undefined,因为 columns 属性是可选的(使用了 ?)。

然后 Exclude<EditableTableProps["columns"], undefined> 的含义是:从 EditableTableProps["columns"] 类型中排除 undefined 类型。
所以 ColumnTypes 类型将会是 Column[],表示不包含 undefined 的情况,确保了 columns 属性在使用时一定存在且其类型为 Column[]

标签:Column,EditableTableProps,ColumnTypes,类型,Exclude,type,columns
From: https://www.cnblogs.com/longmo666/p/18025174

相关文章

  • [Rust] Reference Types in Rust
    LearnhowtocreatereferencesinRustusingtheborrow-operator & andwhentheyareuseful.Foramorethoroughexplanationofreferencesandtheircharacteristics,checkoutthisblogpost:https://blog.thoughtram.io/references-in-rust/letname:St......
  • input,type为number时隐藏点击按钮和限制输入最大最小值
    //隐藏点击按钮input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none;}input[type='number']{-moz-appearance:textfield;}//解决输入中文后光标上移的问题.el-input__inner{line-height:1px!important;}//......
  • 测试面试题4-HTTP请求头中Content-Type的作用是什么?
    在HTTP请求头中,Content-Type是用来指示请求或响应中实体主体的媒体类型的字段。它告诉服务器或客户端实体主体的数据类型是什么,以便正确解析数据。以下是一些常见的Content-Type类型:text/plain:纯文本格式text/html:HTML格式application/json:JSON格式application/xml:XML......
  • [Rust] Integer Types in Rust
    Thislessontalksabout Integer typesinRustandthatthereare unsigned and signed integers.Italsoexplainshoweverythetypenamesarecomposedof"u"and"i",forunsignedandsignedrespectively,followedbytheir withinbits.......
  • password_encryption_type 和 pg_hba.conf 不匹配导致用户连不上
    问题概述xxx客户新上一套opengauss数据库,在测试中用户输入正确的密码,提示用户密码错误,导致用户被锁问题原因password_encryption_type和pg_hba.conf不匹配导致用户连不上模拟问题因没有opengauss的环境,测试环境选择Mogdb1、准备测试环境,修改password_encryption_type。......
  • Type information 反射信息 Type指一个对象的种类,某种自定义的class,某个interface或st
    Typeinformation反射信息Type指一个对象的种类,某种自定义的class,某个interface或string等,都是type的一种。 (本文参考了Thinkinginjava中的typeinformation这章)什么是TypeinformationType指一个对象的种类,某种自定义的class,某个interface或string等,都是type的一......
  • Flink 使用之 TypeInformation 由于泛型类型在运行时会被JVM擦除,所以要指定类型
    Flink使用之TypeInformation由于泛型类型在运行时会被JVM擦除,所以要指定类型Flink使用介绍相关文档目录Flink使用介绍相关文档目录背景本篇从近期遇到的StreamJavaAPI问题,引出TypeInformation的使用。Exceptioninthread"main"org.apache.flink.api.common.functi......
  • HTML <!DOCTYPE>标记
    原文链接:https://blog.csdn.net/wuxiaopengnihao1/article/details/126521900描述HTML <!DOCTYPE>标记一般放在HTML文档中的第一行。它告诉浏览器要编写文档的HTML版本,以便浏览器知道预期的内容。此标记通常也称为<!DOCTYPE>元素。句法<!DOCTYPE>标记的语法在所使用的HTML或XHTML......
  • [Go] Get used to return (*SomeType, error) as function return type
    packagemainimport( "fmt" "log" "strconv" "strings")typePointstruct{ xint yint}typeLinestruct{ p1*Point p2*Point}funcgetInput()string{return`0,9->5,98,0->0,89,4->......
  • typescript修改target导致模块找不到
    编译ts代码时,发现一个包只支持es6及更高的版本,无奈修改编译选项target,从es5修改为es6,发现原来导入包的地方报错,提示notfound。tsconfig.json{"files":["src/main.ts"],"compilerOptions":{"noImplicitAny":true,"target":......