-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-select-fields.ts
More file actions
34 lines (24 loc) · 902 Bytes
/
test-select-fields.ts
File metadata and controls
34 lines (24 loc) · 902 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
* Test to verify SelectFields type works correctly
* This file should compile without errors
*/
import type { A_BusinessPartnerType, SelectFields } from './types/s4kit-types';
// ✅ This should work - valid fields
const validSelect: SelectFields<A_BusinessPartnerType> = [
'BusinessPartner',
'BusinessPartnerFullName',
'BusinessPartnerName',
];
// ❌ This should cause a TypeScript error - invalid field
// const invalidSelect: SelectFields<A_BusinessPartnerType> = [
// 'BusinessPartner',
// 'InvalidField', // TypeScript error: Property 'InvalidField' does not exist
// ];
// ✅ Usage in actual query (with type assertion)
const selectArray = [
'BusinessPartner',
'BusinessPartnerFullName',
] as SelectFields<A_BusinessPartnerType>;
// Verify the type
const test: SelectFields<A_BusinessPartnerType> = selectArray;
console.log('SelectFields type works correctly!');