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:
Corentin Ardeois 2020-07-13 19:56:31 -04:00 committed by GitHub
parent fdbe03122a
commit 68e6288163
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -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;
/**

View File

@ -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({});