-
Notifications
You must be signed in to change notification settings - Fork 213
Expand file tree
/
Copy pathcreateClient.test-d.ts
More file actions
83 lines (68 loc) · 3.38 KB
/
createClient.test-d.ts
File metadata and controls
83 lines (68 loc) · 3.38 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import { expectType } from 'tsd'
import { ContentfulClientApi, createClient } from '../../../lib'
const CLIENT_OPTIONS = {
accessToken: 'accessToken',
space: 'spaceId',
}
expectType<ContentfulClientApi<undefined>>(createClient(CLIENT_OPTIONS))
expectType<ContentfulClientApi<'WITHOUT_LINK_RESOLUTION'>>(
createClient(CLIENT_OPTIONS).withoutLinkResolution,
)
expectType<never>(createClient(CLIENT_OPTIONS).withoutLinkResolution.withoutLinkResolution)
expectType<never>(createClient(CLIENT_OPTIONS).withoutLinkResolution.withoutUnresolvableLinks)
expectType<ContentfulClientApi<'WITHOUT_LINK_RESOLUTION' | 'WITH_ALL_LOCALES'>>(
createClient(CLIENT_OPTIONS).withoutLinkResolution.withAllLocales,
)
expectType<never>(
createClient(CLIENT_OPTIONS).withoutLinkResolution.withAllLocales.withoutLinkResolution,
)
expectType<never>(createClient(CLIENT_OPTIONS).withoutLinkResolution.withAllLocales.withAllLocales)
expectType<never>(
createClient(CLIENT_OPTIONS).withoutLinkResolution.withAllLocales.withoutLinkResolution,
)
expectType<ContentfulClientApi<'WITHOUT_UNRESOLVABLE_LINKS'>>(
createClient(CLIENT_OPTIONS).withoutUnresolvableLinks,
)
expectType<never>(createClient(CLIENT_OPTIONS).withoutUnresolvableLinks.withoutUnresolvableLinks)
expectType<never>(createClient(CLIENT_OPTIONS).withoutUnresolvableLinks.withoutLinkResolution)
expectType<ContentfulClientApi<'WITHOUT_UNRESOLVABLE_LINKS' | 'WITH_ALL_LOCALES'>>(
createClient(CLIENT_OPTIONS).withoutUnresolvableLinks.withAllLocales,
)
expectType<never>(
createClient(CLIENT_OPTIONS).withoutUnresolvableLinks.withAllLocales.withoutUnresolvableLinks,
)
expectType<never>(
createClient(CLIENT_OPTIONS).withoutUnresolvableLinks.withAllLocales.withAllLocales,
)
expectType<never>(
createClient(CLIENT_OPTIONS).withoutUnresolvableLinks.withAllLocales.withoutLinkResolution,
)
expectType<ContentfulClientApi<'WITH_ALL_LOCALES'>>(createClient(CLIENT_OPTIONS).withAllLocales)
expectType<never>(createClient(CLIENT_OPTIONS).withAllLocales.withAllLocales)
expectType<ContentfulClientApi<'WITH_ALL_LOCALES' | 'WITHOUT_LINK_RESOLUTION'>>(
createClient(CLIENT_OPTIONS).withAllLocales.withoutLinkResolution,
)
expectType<ContentfulClientApi<'WITH_ALL_LOCALES' | 'WITHOUT_UNRESOLVABLE_LINKS'>>(
createClient(CLIENT_OPTIONS).withAllLocales.withoutUnresolvableLinks,
)
expectType<ContentfulClientApi<'WITH_LOCALE_BASED_PUBLISHING'>>(
createClient(CLIENT_OPTIONS).withLocaleBasedPublishing,
)
expectType<never>(createClient(CLIENT_OPTIONS).withLocaleBasedPublishing.withLocaleBasedPublishing)
expectType<ContentfulClientApi<'WITH_LOCALE_BASED_PUBLISHING' | 'WITH_ALL_LOCALES'>>(
createClient(CLIENT_OPTIONS).withLocaleBasedPublishing.withAllLocales,
)
expectType<ContentfulClientApi<'WITH_LOCALE_BASED_PUBLISHING' | 'WITHOUT_LINK_RESOLUTION'>>(
createClient(CLIENT_OPTIONS).withLocaleBasedPublishing.withoutLinkResolution,
)
expectType<ContentfulClientApi<'WITH_LOCALE_BASED_PUBLISHING' | 'WITHOUT_UNRESOLVABLE_LINKS'>>(
createClient(CLIENT_OPTIONS).withLocaleBasedPublishing.withoutUnresolvableLinks,
)
expectType<
ContentfulClientApi<
'WITH_LOCALE_BASED_PUBLISHING' | 'WITH_ALL_LOCALES' | 'WITHOUT_LINK_RESOLUTION'
>
>(createClient(CLIENT_OPTIONS).withLocaleBasedPublishing.withAllLocales.withoutLinkResolution)
expectType<ContentfulClientApi<'WITH_ALL_LOCALES' | 'WITH_LOCALE_BASED_PUBLISHING'>>(
createClient(CLIENT_OPTIONS).withAllLocales.withLocaleBasedPublishing,
)