-
-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathindex.test-d.ts
More file actions
39 lines (35 loc) · 780 Bytes
/
index.test-d.ts
File metadata and controls
39 lines (35 loc) · 780 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
31
32
33
34
35
36
37
38
39
import {expectType} from 'tsd';
import {linkifyUrlsToHtml, linkifyUrlsToDom} from './index.js';
expectType<string>(
linkifyUrlsToHtml('See https://sindresorhus.com', {
attributes: {
class: 'unicorn',
one: 1,
foo: true,
multiple: ['a', 'b'],
},
}),
);
expectType<string>(
linkifyUrlsToHtml('See https://sindresorhus.com', {
value: 'foo',
}),
);
expectType<string>(
linkifyUrlsToHtml('See https://sindresorhus.com/foo', {
value(url) {
expectType<string>(url);
return url;
},
}),
);
expectType<string>(
linkifyUrlsToHtml('See https://sindresorhus.com/foo'),
);
const fragment = linkifyUrlsToDom('See https://sindresorhus.com', {
attributes: {
class: 'unicorn',
},
});
expectType<DocumentFragment>(fragment);
document.body.append(fragment);