1"use strict";(self.webpackChunkjustwe7_books=self.webpackChunkjustwe7_books||[]).push([[2410],{3905:(e,t,r)=>{r.d(t,{Zo:()=>i,kt:()=>m});var n=r(67294);function l(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?p(Object(r),!0).forEach((function(t){l(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function a(e,t){if(null==e)return{};var r,n,l=function(e,t){if(null==e)return{};var r,n,l={},p=Object.keys(e);for(n=0;n<p.length;n++)r=p[n],t.indexOf(r)>=0||(l[r]=e[r]);return l}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n<p.length;n++)r=p[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(l[r]=e[r])}return l}var o=n.createContext({}),u=function(e){var t=n.useContext(o),r=t;return e&&(r="function"==typeof e?e(t):c(c({},t),e)),r},i=function(e){var t=u(e.components);return n.createElement(o.Provider,{value:t},e.children)},s="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},y=n.forwardRef((function(e,t){var r=e.components,l=e.mdxType,p=e.originalType,o=e.parentName,i=a(e,["components","mdxType","originalType","parentName"]),s=u(r),y=l,m=s["".concat(o,".").concat(y)]||s[y]||d[y]||p;return r?n.createElement(m,c(c({ref:t},i),{},{components:r})):n.createElement(m,c({ref:t},i))}));function m(e,t){var r=arguments,l=t&&t.mdxType;if("string"==typeof e||l){var p=r.length,c=new Array(p);c[0]=y;var a={};for(var o in t)hasOwnProperty.call(t,o)&&(a[o]=t[o]);a.originalType=e,a[s]="string"==typeof e?e:l,c[1]=a;for(var u=2;u<p;u++)c[u]=r[u];return n.createElement.apply(null,c)}return n.createElement.apply(null,r)}y.displayName="MDXCreateElement"},1650:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>y,frontMatter:()=>a,metadata:()=>u,toc:()=>s});var n=r(87462),l=r(63366),p=(r(67294),r(3905));const c=["components"],a={},o=void 0,u={unversionedId:"\u524d\u7aef\u5f00\u53d1/\u641e\u5b9atypescript/\u5de5\u5177\u7c7b\u578b\u4e4bExclude",id:"\u524d\u7aef\u5f00\u53d1/\u641e\u5b9atypescript/\u5de5\u5177\u7c7b\u578b\u4e4bExclude",title:"\u5de5\u5177\u7c7b\u578b\u4e4bExclude",description:"Exclude",source:"@site/docs/\u524d\u7aef\u5f00\u53d1/\u641e\u5b9atypescript/\u5de5\u5177\u7c7b\u578b\u4e4bExclude.md",sourceDirName:"\u524d\u7aef\u5f00\u53d1/\u641e\u5b9atypescript",slug:"/\u524d\u7aef\u5f00\u53d1/\u641e\u5b9atypescript/\u5de5\u5177\u7c7b\u578b\u4e4bExclude",permalink:"/docs/\u524d\u7aef\u5f00\u53d1/\u641e\u5b9atypescript/\u5de5\u5177\u7c7b\u578b\u4e4bExclude",draft:!1,editUrl:"https://github.com/justwe7/justwe7.github.io/blob/feature/docs/\u524d\u7aef\u5f00\u53d1/\u641e\u5b9atypescript/\u5de5\u5177\u7c7b\u578b\u4e4bExclude.md",tags:[],version:"current",lastUpdatedAt:1790659272,formattedLastUpdatedAt:"2026\u5e749\u670829\u65e5",frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"\u58f0\u660e\u6587\u4ef6",permalink:"/docs/\u524d\u7aef\u5f00\u53d1/\u641e\u5b9atypescript/\u58f0\u660e\u6587\u4ef6"},next:{title:"\u5de5\u5177\u7c7b\u578b\u4e4bExtract",permalink:"/docs/\u524d\u7aef\u5f00\u53d1/\u641e\u5b9atypescript/\u5de5\u5177\u7c7b\u578b\u4e4bExtract"}},i={},s=[],d={toc:s};function y(e){let{components:t}=e,r=(0,l.Z)(e,c);return(0,p.kt)("wrapper",(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("blockquote",null,(0,p.kt)("p",{parentName:"blockquote"},(0,p.kt)("inlineCode",{parentName:"p"},"Exclude<T, U>")),(0,p.kt)("p",{parentName:"blockquote"},"\u7528\u4e8e\u4ece\u7c7b\u578bT\u4e0e\u7c7b\u578bU\u8fdb\u884c\u5bf9\u6bd4\uff0c\u4eceT\u4e2d\u53d6\u51fa\u72ec\u6709\u7684\u5c5e\u6027\u751f\u6210\u65b0\u7684\u7c7b\u578b\uff08\u4e0eExclude\u76f8\u53cd\uff09"),(0,p.kt)("p",{parentName:"blockquote"},"\u5f53\u6211\u4eec\u60f3\u8981\u5b9a\u4e49\u4e00\u4e2a\uff1a\u539f\u59cb\u8054\u5408\u7c7b\u578b\u4e0e\u7279\u5b9a\u53d8\u91cf\u7684\u4ea4\u96c6\u65f6\u53ef\u4ee5\u4f7f\u7528\u5b83")),(0,p.kt)("p",null,(0,p.kt)("a",{parentName:"p",href:"https://codesandbox.io/s/tsgong-ju-lei-xing-pc65yr?file=/src/index.tsx"},"\u793a\u4f8b\u4ee3\u7801")),(0,p.kt)("p",null,"\u5047\u8bbe\u73b0\u6709\u7c7b\u578b\u5b9a\u4e49\u4e2d\u5b9a\u4e49\u4e86\u4e00\u4e2a\u8054\u5408\u7c7b\u578b"),(0,p.kt)("pre",null,(0,p.kt)("code",{parentName:"pre",className:"language-ts"},"type ExcludeType = '\u55b5\u55b5' | '\u6c6a\u6c6a' | '\u55b5\u545c' | '\u54a9\u54a9'\nconst ExcludeCat: ExcludeType = '\u55b5\u55b5'\n")),(0,p.kt)("p",null,"\u4f7f\u7528",(0,p.kt)("inlineCode",{parentName:"p"},"Exclude"),"\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u7c7b\u578b\uff1a"),(0,p.kt)("pre",null,(0,p.kt)("code",{parentName:"pre",className:"language-ts"},"type ExcludeCatType = '\u55b5\u55b5'\nlet ExcludePet: Exclude<ExcludeCatType, ExcludeType> = '\u55b5\u55b5'\n")),(0,p.kt)("p",null,"\u56e0\u4e3a\u8fd9\u4e24\u4e2a\u7c7b\u578b\u5b9a\u4e49U\u548cT\u7684\u5dee\u96c6\u4e0d\u5b58\u5728\uff0c\u6240\u4ee5\u5b83\u7684\u503c\u5fc5\u4e0d\u7b26\u53f7\u6761\u4ef6\uff0c\u6b64\u65f6\u7f16\u8bd1\u65f6\u4f1a\u629b\u51fa\u9519\u8bef\uff1a",(0,p.kt)("inlineCode",{parentName:"p"},"Type 'string' is not assignable to type 'never'.ts(2322)")),(0,p.kt)("p",null,"\u6b63\u786e\uff08",(0,p.kt)("del",{parentName:"p"},"\u4e0d\u62a5\u9519"),"\uff09\u7684\u5199\u6cd5\u5e94\u8be5\u662f\uff1a"),(0,p.kt)("pre",null,(0,p.kt)("code",{parentName:"pre",className:"language-ts"},"type ExcludeCatType = '\u55b5\u55b5'\ntype ExcludePetsType = '\u6c6a\u6c6a'|'\u55b5\u55b5'\nlet ExcludeWildAnimals1: Exclude<ExcludeType, ExcludePetsType> = '\u54a9\u54a9' // \u901a\u8fc7\nlet ExcludeWildAnimals2: Exclude<ExcludePetsType, ExcludeType> = '\u54a9\u54a9' // \u53cd\u4e4b\u5219\u62a5\u9519\uff1a Type 'string' is not assignable to type 'never'.ts(2322)\n")))}y.isMDXComponent=!0}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.