mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
fix(@types/styled-system__css): build performance issues with css function (#45880)
* @types/styled-system__css fix performance issues When we intensively use the function `css`, typescript declaration file are really slow to compile and generated files are huge. This is due to `css` return type being inline for every usage of the function. To fix the issue, we just export the return type, so it can be reused * test: add unit test * chore: run prettier
This commit is contained in:
parent
fdbe03122a
commit
68e6288163
3
types/styled-system__css/index.d.ts
vendored
3
types/styled-system__css/index.d.ts
vendored
@ -589,7 +589,8 @@ export interface ScaleThemeProperties {
|
||||
* If you're using variants in your theme, you can access them by using the `variant`
|
||||
* property. The value of the property has to correspond to a path of your `Theme`.
|
||||
*/
|
||||
export function css(input?: SystemStyleObject): (props?: Theme | { theme: Theme }) => CSSObject;
|
||||
export type CssFunctionReturnType = (props?: Theme | { theme: Theme }) => CSSObject;
|
||||
export function css(input?: SystemStyleObject): CssFunctionReturnType;
|
||||
export default css;
|
||||
|
||||
/**
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import css, { Theme } from '@styled-system/css';
|
||||
import css, { CssFunctionReturnType, Theme } from '@styled-system/css';
|
||||
|
||||
const theme = {
|
||||
colors: {
|
||||
@ -260,3 +260,5 @@ css({
|
||||
label: 'baz',
|
||||
},
|
||||
});
|
||||
|
||||
const result: CssFunctionReturnType = css({});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user