测试一下record
This commit is contained in:
		
							
								
								
									
										20
									
								
								code/ts-practice/src/type.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								code/ts-practice/src/type.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: Kane
 | 
			
		||||
 * @Date: 2023-03-09 17:04:12
 | 
			
		||||
 * @LastEditors: Kane
 | 
			
		||||
 * @FilePath: /ts-practice/src/type.ts
 | 
			
		||||
 * @Description:
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (c) ${2022} by Kane, All Rights Reserved.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
type K = (number | string);
 | 
			
		||||
type T = string | number | boolean;
 | 
			
		||||
type R = Record<K, T>;
 | 
			
		||||
 | 
			
		||||
const test: R = {
 | 
			
		||||
    x: 2,
 | 
			
		||||
    a: 1,
 | 
			
		||||
    b: true,
 | 
			
		||||
    1: 2,
 | 
			
		||||
};
 | 
			
		||||
		Reference in New Issue
	
	Block a user