diff --git a/types/carbon__layout/carbon__layout-tests.ts b/types/carbon__layout/carbon__layout-tests.ts new file mode 100644 index 0000000000..ef002f50ae --- /dev/null +++ b/types/carbon__layout/carbon__layout-tests.ts @@ -0,0 +1,20 @@ +import { + rem, + em, + px, + breakpoint, + breakpoints, + breakpointDown, + breakpointUp, + baseFontSize +} from "@carbon/layout"; + +const firstBreakpoint = Object.keys(breakpoints)[0]; + +rem(baseFontSize); // $ExpectType string +em(baseFontSize); // $ExpectType string +px(baseFontSize); // $ExpectType string + +breakpoint(firstBreakpoint); // $ExpectType string +breakpointUp(firstBreakpoint); // $ExpectType string +breakpointDown(firstBreakpoint); // $ExpectType string diff --git a/types/carbon__layout/index.d.ts b/types/carbon__layout/index.d.ts new file mode 100644 index 0000000000..1d7c7b4630 --- /dev/null +++ b/types/carbon__layout/index.d.ts @@ -0,0 +1,80 @@ +// Type definitions for @carbon/layout 0.0 +// Project: https://github.com/IBM/carbon-elements/tree/master/packages/layout +// Definitions by: Vince Picone +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export const baseFontSize: number; + +export const breakpoints: { + lg: { + columns: number; + margin: string; + width: string; + }; + max: { + columns: number; + margin: string; + width: string; + }; + md: { + columns: number; + margin: string; + width: string; + }; + sm: { + columns: number; + margin: string; + width: string; + }; + xlg: { + columns: number; + margin: string; + width: string; + }; +}; + +export const miniUnit: number; + +export const spacing: number[]; + +export function breakpoint(...args: any[]): string; + +export function breakpointDown(name: string): string; + +export function breakpointUp(name: string): string; + +export function em(px: number): string; + +export function miniUnits(count: number): string; + +export function px(value: number): string; + +export function rem(px: number): string; + +export namespace breakpoint { + const prototype: {}; +} + +export namespace breakpointDown { + const prototype: {}; +} + +export namespace breakpointUp { + const prototype: {}; +} + +export namespace em { + const prototype: {}; +} + +export namespace miniUnits { + const prototype: {}; +} + +export namespace px { + const prototype: {}; +} + +export namespace rem { + const prototype: {}; +} diff --git a/types/carbon__layout/tsconfig.json b/types/carbon__layout/tsconfig.json new file mode 100644 index 0000000000..10f832a631 --- /dev/null +++ b/types/carbon__layout/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "paths": { + "@carbon/layout": ["carbon__layout"] + } + }, + "files": ["index.d.ts", "carbon__layout-tests.ts"] +} diff --git a/types/carbon__layout/tslint.json b/types/carbon__layout/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/carbon__layout/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }