{"id":10008175,"date":"2023-08-28T15:00:18","date_gmt":"2023-08-28T07:00:18","guid":{"rendered":"https:\/\/blog.itmax.cn\/?p=10008175"},"modified":"2023-08-28T15:00:18","modified_gmt":"2023-08-28T07:00:18","slug":"%e9%9d%a2%e8%af%95%e5%ae%98%ef%bc%9a%e8%af%b4%e8%af%b4%e7%b1%bb%e5%9e%8b%e5%ae%88%e5%8d%ab%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10008175","title":{"rendered":"\u9762\u8bd5\u5b98\uff1a\u8bf4\u8bf4\u7c7b\u578b\u5b88\u536b\uff1f"},"content":{"rendered":"<h2>\u7c7b\u578b\u5b88\u536b<\/h2>\n<h3>\u6982\u8ff0<\/h3>\n<p>\u5728 TypeScript \u4e2d\uff0c\u7c7b\u578b\u5b88\u536b\u53ef\u4ee5\u7528\u4e8e\u5728\u8fd0\u884c\u65f6\u68c0\u67e5\u53d8\u91cf\u7684\u7c7b\u578b\uff0c\u5e76\u5728\u4ee3\u7801\u5757\u5185\u90e8\u5c06\u53d8\u91cf\u7684\u7c7b\u578b\u8303\u56f4\u7f29\u5c0f\u5230\u66f4\u5177\u4f53\u7684\u7c7b\u578b\u3002\u8fd9\u79cd\u7c7b\u578b\u6536\u7a84\u53ef\u4ee5\u8ba9 TypeScript \u7f16\u8bd1\u5668\u66f4\u597d\u5730\u7406\u89e3\u6211\u4eec\u4ee3\u7801\u7684\u610f\u56fe\uff0c\u4ece\u800c\u63d0\u4f9b\u66f4\u51c6\u786e\u7684\u7c7b\u578b\u63a8\u65ad\u548c\u7c7b\u578b\u68c0\u67e5\u3002<\/p>\n<p>\u7c7b\u578b\u5b88\u536b\u901a\u5e38\u4f7f\u7528\u7c7b\u578b\u65ad\u8a00\u3001\u7c7b\u578b\u8c13\u8bcd\u3001typeof \u64cd\u4f5c\u7b26\u3001instanceof \u64cd\u4f5c\u7b26\u6216\u81ea\u5b9a\u4e49\u7684\u8c13\u8bcd\u51fd\u6570\u6765\u5224\u65ad\u53d8\u91cf\u7684\u5177\u4f53\u7c7b\u578b\uff0c\u5e76\u6839\u636e\u5224\u65ad\u7ed3\u679c\u6536\u7a84\u53d8\u91cf\u7684\u7c7b\u578b\u8303\u56f4\u3002<\/p>\n<h3>typeof \u7c7b\u578b\u5b88\u536b<\/h3>\n<p>typeof \u7c7b\u578b\u5b88\u536b\u5141\u8bb8\u6211\u4eec\u4f7f\u7528 typeof \u64cd\u4f5c\u7b26\u6765\u5728\u4ee3\u7801\u4e2d\u6839\u636e\u53d8\u91cf\u7684\u7c7b\u578b\u8303\u56f4\u8fdb\u884c\u6761\u4ef6\u5224\u65ad\u3002<\/p>\n<pre><code class=\"typescript\">function printValue(value: string | number) {\n  if (typeof value === 'string') {\n    console.log(value.toUpperCase());\n  } else {\n    console.log(value.toFixed(2));\n  }\n}\n\nprintValue('hello');  \/\/ \u8f93\u51fa: HELLO\nprintValue(3.1415);   \/\/ \u8f93\u51fa: 3.14<\/code><\/pre>\n<p>\u5728\u4e0a\u9762\u7684\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528 typeof \u64cd\u4f5c\u7b26\u5728\u6761\u4ef6\u8bed\u53e5\u4e2d\u68c0\u67e5\u53d8\u91cf <code>value<\/code> \u7684\u7c7b\u578b\u3002\u5982\u679c\u5b83\u7684\u7c7b\u578b\u662f <code>'string'<\/code>\uff0c\u5219\u8c03\u7528 <code>toUpperCase<\/code> \u65b9\u6cd5\uff1b\u5982\u679c\u662f <code>'number'<\/code>\uff0c\u5219\u8c03\u7528 <code>toFixed<\/code> \u65b9\u6cd5\u3002\u901a\u8fc7\u4f7f\u7528 typeof \u7c7b\u578b\u5b88\u536b\uff0c\u6211\u4eec\u80fd\u591f\u6839\u636e\u4e0d\u540c\u7684\u7c7b\u578b\u6267\u884c\u4e0d\u540c\u7684\u4ee3\u7801\u903b\u8f91\u3002<\/p>\n<h3>instanceof \u7c7b\u578b\u5b88\u536b<\/h3>\n<p>instanceof \u7c7b\u578b\u5b88\u536b\u5141\u8bb8\u6211\u4eec\u4f7f\u7528 instanceof \u64cd\u4f5c\u7b26\u6765\u68c0\u67e5\u5bf9\u8c61\u7684\u7c7b\u578b\uff0c\u5e76\u5728\u4ee3\u7801\u5757\u5185\u90e8\u6536\u7a84\u5bf9\u8c61\u7684\u7c7b\u578b\u8303\u56f4\u3002<\/p>\n<pre><code class=\"typescript\">class Animal {\n  move() {\n    console.log('Animal is moving');\n  }\n}\n\nclass Dog extends Animal {\n  bark() {\n    console.log('Dog is barking');\n  }\n}\n\nfunction performAction(animal: Animal) {\n  if (animal instanceof Dog) {\n    animal.bark();\n  } else {\n    animal.move();\n  }\n}\n\nconst animal1 = new Animal();\nconst animal2 = new Dog();\n\nperformAction(animal1);  \/\/ \u8f93\u51fa: Animal is moving\nperformAction(animal2);  \/\/ \u8f93\u51fa: Dog is barking<\/code><\/pre>\n<p>\u5728\u4e0a\u9762\u7684\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528 instanceof \u64cd\u4f5c\u7b26\u5728\u6761\u4ef6\u8bed\u53e5\u4e2d\u68c0\u67e5\u53d8\u91cf <code>animal<\/code> \u7684\u7c7b\u578b\u3002\u5982\u679c\u5b83\u662f Dog \u7c7b\u7684\u5b9e\u4f8b\uff0c\u5219\u8c03\u7528 <code>bark<\/code> \u65b9\u6cd5\uff1b\u5426\u5219\u8c03\u7528 <code>move<\/code> \u65b9\u6cd5\u3002\u901a\u8fc7\u4f7f\u7528 instanceof \u7c7b\u578b\u5b88\u536b\uff0c\u6211\u4eec\u53ef\u4ee5\u6839\u636e\u5bf9\u8c61\u7684\u5177\u4f53\u7c7b\u578b\u6267\u884c\u4e0d<\/p>\n<p>\u540c\u7684\u4ee3\u7801\u903b\u8f91\u3002<\/p>\n<h3>\u4f7f\u7528\u81ea\u5b9a\u4e49\u8c13\u8bcd\u51fd\u6570\u7c7b\u578b\u5b88\u536b<\/h3>\n<p>\u81ea\u5b9a\u4e49\u8c13\u8bcd\u51fd\u6570\u7c7b\u578b\u5b88\u536b\u5141\u8bb8\u6211\u4eec\u5b9a\u4e49\u81ea\u5df1\u7684\u51fd\u6570\uff0c\u6839\u636e\u7279\u5b9a\u6761\u4ef6\u5224\u65ad\u53d8\u91cf\u7684\u7c7b\u578b\uff0c\u5e76\u5728\u4ee3\u7801\u5757\u5185\u90e8\u6536\u7a84\u53d8\u91cf\u7684\u7c7b\u578b\u8303\u56f4\u3002<\/p>\n<pre><code class=\"typescript\">interface Circle {\n  kind: 'circle';\n  radius: number;\n}\n\ninterface Rectangle {\n  kind: 'rectangle';\n  width: number;\n  height: number;\n}\n\ntype Shape = Circle | Rectangle;\n\nfunction calculateArea(shape: Shape) {\n  if (isCircle(shape)) {\n    console.log(Math.PI * shape.radius ** 2);\n  } else {\n    console.log(shape.width * shape.height);\n  }\n}\n\nfunction isCircle(shape: Shape): shape is Circle {\n  return shape.kind === 'circle';\n}\n\nconst circle: Circle = { kind: 'circle', radius: 5 };\nconst rectangle: Rectangle = { kind: 'rectangle', width: 10, height: 20 };\n\ncalculateArea(circle);     \/\/ \u8f93\u51fa: 78.53981633974483\ncalculateArea(rectangle);  \/\/ \u8f93\u51fa: 200<\/code><\/pre>\n<p>\u5728\u4e0a\u9762\u7684\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u5b9a\u4e49\u4e86 <code>Shape<\/code> \u7c7b\u578b\uff0c\u5b83\u53ef\u4ee5\u662f <code>Circle<\/code> \u6216 <code>Rectangle<\/code>\u3002\u901a\u8fc7\u81ea\u5b9a\u4e49\u7684\u8c13\u8bcd\u51fd\u6570 <code>isCircle<\/code>\uff0c\u6211\u4eec\u5224\u65ad\u53d8\u91cf <code>shape<\/code> \u7684\u7c7b\u578b\u662f\u5426\u662f <code>Circle<\/code>\uff0c\u5e76\u5728\u6761\u4ef6\u8bed\u53e5\u5185\u90e8\u6536\u7a84\u53d8\u91cf\u7684\u7c7b\u578b\u8303\u56f4\u3002\u901a\u8fc7\u4f7f\u7528\u81ea\u5b9a\u4e49\u8c13\u8bcd\u51fd\u6570\u7c7b\u578b\u5b88\u536b\uff0c\u6211\u4eec\u80fd\u591f\u6839\u636e\u7279\u5b9a\u7684\u8c13\u8bcd\u6761\u4ef6\u6267\u884c\u76f8\u5e94\u7684\u4ee3\u7801\u903b\u8f91\u3002<\/p>\n<h3>\u8054\u5408\u7c7b\u578b\u5b88\u536b<\/h3>\n<p>\u7c7b\u578b\u5b88\u536b\u6700\u5e38\u7528\u4e8e\u8054\u5408\u7c7b\u578b\u4e2d\uff0c\u56e0\u4e3a\u8054\u5408\u7c7b\u578b\u53ef\u80fd\u5305\u542b\u591a\u4e2a\u4e0d\u540c\u7684\u7c7b\u578b\u9009\u9879\u3002<\/p>\n<pre><code class=\"typescript\">interface Car {\n  type: 'car';\n  brand: string;\n  wheels: number;\n}\n\ninterface Bicycle {\n  type: 'bicycle';\n  color: string;\n}\n\ninterface Motorcycle {\n  type: 'motorcycle';\n  engine: number;\n}\n\ntype Vehicle = Car | Bicycle | Motorcycle;\n\nfunction printVehicleInfo(vehicle: Vehicle) {\n  switch (vehicle.type) {\n    case 'car':\n      console.log(`Brand: ${vehicle.brand}, Wheels: ${vehicle.wheels}`);\n      break;\n    case 'bicycle':\n      console.log(`Color: ${vehicle.color}`);\n      break;\n    case 'motorcycle':\n      console.log(`Engine: ${vehicle.engine}`);\n      break;\n    default:\n      const _exhaustiveCheck: never = vehicle;\n  }\n}\n\nconst car: Car = { type: 'car', brand: 'Toyota', wheels: 4 };\nconst bicycle: Bicycle = { type: 'bicycle', color: 'red' };\nconst motorcycle: Motorcycle = { type: 'motorcycle', engine: 1000 };\n\nprintVehicleInfo(car);         \/\/ \u8f93\u51fa: Brand: Toyota, Wheels: 4\nprintVehicleInfo(bicycle);     \/\/ \u8f93\u51fa: Color: red\nprintVehicleInfo(motorcycle);  \/\/ \u8f93\u51fa: Engine: 1000<\/code><\/pre>\n<p>\u5728\u4e0a\u9762\u7684\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u5b9a\u4e49\u4e86 <code>Vehicle<\/code> \u7c7b\u578b\uff0c\u5b83\u662f <code>Car<\/code>\u3001<code>Bicycle<\/code> \u548c `Motor<\/p>\n<p>cycle<code> \u7684\u8054\u5408\u7c7b\u578b\u3002\u901a\u8fc7\u4f7f\u7528 <\/code>switch<code> \u8bed\u53e5\u548c\u6839\u636e <\/code>vehicle.type<code> \u7684\u4e0d\u540c\u503c\u8fdb\u884c\u7c7b\u578b\u5b88\u536b\uff0c\u6211\u4eec\u53ef\u4ee5\u5728\u6bcf\u4e2a <\/code>case<code> \u5206\u652f\u4e2d\u6536\u7a84 <\/code>vehicle` \u7684\u7c7b\u578b\u8303\u56f4\uff0c\u5e76\u6267\u884c\u76f8\u5e94\u7684\u4ee3\u7801\u903b\u8f91\u3002\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c\u6211\u4eec\u80fd\u591f\u66f4\u51c6\u786e\u5730\u63a8\u65ad\u548c\u68c0\u67e5\u8054\u5408\u7c7b\u578b\u7684\u53d8\u91cf\u3002<\/p>\n<h4>\u4f7f\u7528 <code>in<\/code> \u64cd\u4f5c\u7b26\u8fdb\u884c\u7c7b\u578b\u5b88\u536b<\/h4>\n<p><code>in<\/code> \u64cd\u4f5c\u7b26\u53ef\u4ee5\u7528\u4e8e\u5728 TypeScript \u4e2d\u5224\u65ad\u4e00\u4e2a\u5c5e\u6027\u662f\u5426\u5b58\u5728\u4e8e\u5bf9\u8c61\u4e2d\uff0c\u4ece\u800c\u8fdb\u884c\u7c7b\u578b\u5224\u65ad\u548c\u7c7b\u578b\u6536\u7a84\u3002<\/p>\n<pre><code class=\"typescript\">interface Circle {\n  kind: 'circle';\n  radius: number;\n}\n\ninterface Rectangle {\n  kind: 'rectangle';\n  width: number;\n  height: number;\n}\n\ntype Shape = Circle | Rectangle;\n\nfunction printArea(shape: Shape) {\n  if ('radius' in shape) {\n    console.log(Math.PI * shape.radius ** 2);\n  } else {\n    console.log(shape.width * shape.height);\n  }\n}\n\nconst circle: Circle = { kind: 'circle', radius: 5 };\nconst rectangle: Rectangle = { kind: 'rectangle', width: 10, height: 20 };\n\nprintArea(circle);     \/\/ \u8f93\u51fa: 78.53981633974483\nprintArea(rectangle);  \/\/ \u8f93\u51fa: 200<\/code><\/pre>\n<p>\u5728\u4e0a\u9762\u7684\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528 <code>in<\/code> \u64cd\u4f5c\u7b26\u6765\u68c0\u67e5\u5c5e\u6027 <code>'radius'<\/code> \u662f\u5426\u5b58\u5728\u4e8e <code>shape<\/code> \u5bf9\u8c61\u4e2d\u3002\u5982\u679c\u5b58\u5728\uff0c\u5219\u6536\u7a84 <code>shape<\/code> \u7684\u7c7b\u578b\u4e3a <code>Circle<\/code>\uff0c\u5e76\u6267\u884c\u76f8\u5e94\u7684\u4ee3\u7801\u903b\u8f91\u3002\u901a\u8fc7\u4f7f\u7528 <code>in<\/code> \u64cd\u4f5c\u7b26\u8fdb\u884c\u7c7b\u578b\u5224\u65ad\uff0c\u6211\u4eec\u53ef\u4ee5\u6839\u636e\u5c5e\u6027\u7684\u5b58\u5728\u4e0e\u5426\u8fdb\u884c\u7c7b\u578b\u6536\u7a84\u3002<\/p>\n<h4>\u63a7\u5236\u6d41\u7c7b\u578b\u5b88\u536b<\/h4>\n<p>\u5728 TypeScript \u4e2d\uff0c\u5f53\u6267\u884c\u7279\u5b9a\u7684\u64cd\u4f5c\u540e\uff0c\u7f16\u8bd1\u5668\u4f1a\u667a\u80fd\u5730\u8c03\u6574\u53d8\u91cf\u7684\u7c7b\u578b\u8303\u56f4\uff0c\u8fd9\u88ab\u79f0\u4e3a\u63a7\u5236\u6d41\u7c7b\u578b\u6536\u7a84\u3002<\/p>\n<p><strong>if \u8bed\u53e5\u7684\u6761\u4ef6\u5224\u65ad<\/strong><\/p>\n<pre><code class=\"typescript\">function printValue(value: string | number) {\n  if (typeof value === 'string') {\n    console.log(value.toUpperCase());\n  } else {\n    console.log(value.toFixed(2));\n  }\n}<\/code><\/pre>\n<p>\u5728\u4e0a\u9762\u7684\u793a\u4f8b\u4e2d\uff0c\u5f53\u6267\u884c <code>typeof value === 'string'<\/code> \u7684\u6761\u4ef6\u5224\u65ad\u65f6\uff0cTypeScript \u7f16\u8bd1\u5668\u4f1a\u6536\u7a84 <code>value<\/code> \u7684\u7c7b\u578b\u4e3a <code>string<\/code>\uff0c\u4ece\u800c\u5728\u4ee3\u7801\u5757\u5185\u90e8\u63d0\u4f9b\u76f8\u5e94\u7684\u667a\u80fd\u63d0\u793a\u548c\u7c7b\u578b\u68c0\u67e5\u3002<\/p>\n<p><strong>switch \u8bed\u53e5\u7684 case \u5224\u65ad<\/strong><\/p>\n<pre><code class=\"typescript\">type Fruit = 'apple' | 'banana' | 'orange';\n\nfunction getFruitColor(fruit: Fruit) {\n  let color: string;\n  switch (fruit) {\n    case 'apple':\n      color = 'red';\n      break;\n    case 'banana':\n      color = 'yellow';\n      break;\n    default:\n      color = 'orange';\n  }\n  console.log(`The color of ${fruit} is ${color}`);\n}<\/code><\/pre>\n<p>\u5728\u4e0a\u9762\u7684\u793a\u4f8b\u4e2d\uff0c\u6839\u636e <code>switch<\/code> \u8bed\u53e5\u4e2d\u7684 <code>case<\/code> \u5224\u65ad\uff0cTypeScript \u7f16\u8bd1\u5668\u4f1a\u667a\u80fd\u5730\u6536\u7a84 <code>color<\/code> \u7684\u7c7b\u578b\u4e3a\u76f8\u5e94\u7684\u989c\u8272\u5b57\u7b26\u4e32\u3002<\/p>\n<h4>\u771f\u503c\u7c7b\u578b\u5b88\u536b<\/h4>\n<p>\u771f\u503c\u6536\u7a84\u662f\u4e00\u79cd\u5728\u6761\u4ef6\u8868\u8fbe\u5f0f\u4e2d\u8fdb\u884c\u7c7b\u578b\u6536\u7a84\u7684\u673a\u5236\u3002\u5f53\u6761\u4ef6\u8868\u8fbe\u5f0f\u7684\u7ed3\u679c\u662f\u771f\u503c\u65f6\uff0cTypeScript \u7f16\u8bd1<\/p>\n<p>\u5668\u4f1a\u5c06\u53d8\u91cf\u7684\u7c7b\u578b\u8303\u56f4\u7f29\u5c0f\u4e3a <code>true<\/code> \u7684\u7c7b\u578b\u3002<\/p>\n<pre><code class=\"typescript\">function processValue(value: string | null) {\n  if (value) {\n    console.log(value.toUpperCase());\n  } else {\n    console.log('Value is null or empty');\n  }\n}<\/code><\/pre>\n<p>\u5728\u4e0a\u9762\u7684\u793a\u4f8b\u4e2d\uff0c\u5f53\u6761\u4ef6\u8868\u8fbe\u5f0f <code>value<\/code> \u7684\u7ed3\u679c\u662f\u771f\u503c\uff08\u5373\u4e0d\u4e3a <code>null<\/code> \u6216\u7a7a\u5b57\u7b26\u4e32\uff09\u65f6\uff0cTypeScript \u7f16\u8bd1\u5668\u4f1a\u5c06 <code>value<\/code> \u7684\u7c7b\u578b\u8303\u56f4\u7f29\u5c0f\u4e3a <code>string<\/code>\u3002<\/p>\n<h4>\u81ea\u5b9a\u4e49\u7c7b\u578b\u5224\u65ad\u5f0f\uff08Type Predicates\uff09\u5b88\u536b<\/h4>\n<p>TypeScript \u63d0\u4f9b\u4e86\u81ea\u5b9a\u4e49\u7c7b\u578b\u5224\u65ad\u5f0f\u7684\u529f\u80fd\uff0c\u5b83\u5141\u8bb8\u6211\u4eec\u5b9a\u4e49\u81ea\u5df1\u7684\u8c13\u8bcd\u51fd\u6570\u6765\u8fdb\u884c\u7c7b\u578b\u5224\u65ad\u548c\u7c7b\u578b\u6536\u7a84\u3002<\/p>\n<pre><code class=\"typescript\">interface Bird {\n  fly(): void;\n}\n\ninterface Fish {\n  swim(): void;\n}\n\nfunction isBird(animal: Bird | Fish): animal is Bird {\n  return (animal as Bird).fly !== undefined;\n}\n\nfunction processAnimal(animal: Bird | Fish) {\n  if (isBird(animal)) {\n    animal.fly();\n  } else {\n    animal.swim();\n  }\n}<\/code><\/pre>\n<p>\u5728\u4e0a\u9762\u7684\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u5b9a\u4e49\u4e86 <code>isBird<\/code> \u8c13\u8bcd\u51fd\u6570\u6765\u5224\u65ad\u53c2\u6570 <code>animal<\/code> \u662f\u5426\u5c5e\u4e8e <code>Bird<\/code> \u7c7b\u578b\u3002\u5728 <code>processAnimal<\/code> \u51fd\u6570\u4e2d\uff0c\u901a\u8fc7\u4f7f\u7528\u81ea\u5b9a\u4e49\u8c13\u8bcd\u51fd\u6570 <code>isBird<\/code>\uff0c\u6211\u4eec\u80fd\u591f\u6839\u636e <code>animal<\/code> \u7684\u5177\u4f53\u7c7b\u578b\u6267\u884c\u76f8\u5e94\u7684\u4ee3\u7801\u903b\u8f91\uff0c\u5e76\u5728\u4ee3\u7801\u5757\u5185\u90e8\u6536\u7a84 <code>animal<\/code> \u7684\u7c7b\u578b\u8303\u56f4\u3002<\/p>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000044153893\">https:\/\/segmentfault.com\/a\/1190000044153893<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7c7b\u578b\u5b88\u536b \u6982\u8ff0 \u5728 TypeScript \u4e2d\uff0c\u7c7b\u578b\u5b88\u536b\u53ef\u4ee5\u7528\u4e8e\u5728\u8fd0\u884c\u65f6\u68c0\u67e5\u53d8\u91cf\u7684\u7c7b\u578b\uff0c\u5e76\u5728\u4ee3\u7801\u5757\u5185\u90e8\u5c06\u53d8\u91cf\u7684\u7c7b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-10008175","post","type-post","status-publish","format-standard","hentry","category-share"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10008175","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10008175"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10008175\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10008175"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10008175"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10008175"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}