1
1
/* eslint-disable @typescript-eslint/ban-ts-comment */
2
2
3
3
// @ts -ignore `sass` may not be installed
4
- import type Sass from 'sass'
4
+ import type DartSass from 'sass'
5
+ // @ts -ignore `sass-embedded` may not be installed
6
+ import type SassEmbedded from 'sass-embedded'
5
7
// @ts -ignore `less` may not be installed
6
8
import type Less from 'less'
7
9
// @ts -ignore `less` may not be installed
8
10
import type Stylus from 'stylus'
9
11
10
12
/* eslint-enable @typescript-eslint/ban-ts-comment */
11
13
14
+ // https://github.com/type-challenges/type-challenges/issues/29285
15
+ type IsAny < T > = boolean extends ( T extends never ? true : false ) ? true : false
16
+
17
+ type DartSassLegacyStringOptionsAsync = DartSass . LegacyStringOptions < 'async' >
18
+ type SassEmbeddedLegacyStringOptionsAsync =
19
+ SassEmbedded . LegacyStringOptions < 'async' >
20
+ type SassLegacyStringOptionsAsync =
21
+ IsAny < DartSassLegacyStringOptionsAsync > extends false
22
+ ? DartSassLegacyStringOptionsAsync
23
+ : SassEmbeddedLegacyStringOptionsAsync
24
+
12
25
export type SassLegacyPreprocessBaseOptions = Omit <
13
- Sass . LegacyStringOptions < 'async' > ,
26
+ SassLegacyStringOptionsAsync ,
14
27
| 'data'
15
28
| 'file'
16
29
| 'outFile'
@@ -20,8 +33,15 @@ export type SassLegacyPreprocessBaseOptions = Omit<
20
33
| 'sourceMapRoot'
21
34
>
22
35
36
+ type DartSassStringOptionsAsync = DartSass . StringOptions < 'async' >
37
+ type SassEmbeddedStringOptionsAsync = SassEmbedded . StringOptions < 'async' >
38
+ type SassStringOptionsAsync =
39
+ IsAny < DartSassStringOptionsAsync > extends false
40
+ ? DartSassStringOptionsAsync
41
+ : SassEmbeddedStringOptionsAsync
42
+
23
43
export type SassModernPreprocessBaseOptions = Omit <
24
- Sass . StringOptions < 'async' > ,
44
+ SassStringOptionsAsync ,
25
45
'url' | 'sourceMap'
26
46
>
27
47
0 commit comments