11/* eslint-disable @typescript-eslint/ban-ts-comment */
22
33// @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'
57// @ts -ignore `less` may not be installed
68import type Less from 'less'
79// @ts -ignore `less` may not be installed
810import type Stylus from 'stylus'
911
1012/* eslint-enable @typescript-eslint/ban-ts-comment */
1113
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+
1225export type SassLegacyPreprocessBaseOptions = Omit <
13- Sass . LegacyStringOptions < 'async' > ,
26+ SassLegacyStringOptionsAsync ,
1427 | 'data'
1528 | 'file'
1629 | 'outFile'
@@ -20,8 +33,15 @@ export type SassLegacyPreprocessBaseOptions = Omit<
2033 | 'sourceMapRoot'
2134>
2235
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+
2343export type SassModernPreprocessBaseOptions = Omit <
24- Sass . StringOptions < 'async' > ,
44+ SassStringOptionsAsync ,
2545 'url' | 'sourceMap'
2646>
2747
0 commit comments