santosfrancisco/react-awesome-styled-grid

Config `container` typing is incorrect

Closed this issue ยท 2 comments

The typing for the container property in IConfig seems inaccurate based on the docs. It expects a number container: Record<IGridBreakpoints, number> however the docs indicate you can pass a string "full". Currently I've fixed this at the implementation point by redefining IConfig, but was curious if this is a true bug or if I've misunderstood the docs.

Overall:

interface IConfig {
  media: Record<IGridBreakpoints, ThemedCssFunction<DefaultTheme>>;
  mediaQuery: string;
  columns: Record<IGridBreakpoints, number>;
  gutterWidth: Record<IGridBreakpoints, number>;
  paddingWidth: Record<IGridBreakpoints, number>;
  container: Record<IGridBreakpoints, number>;
  breakpoints: Record<IGridBreakpoints, number>;
}

should likely become

interface IConfig {
  media: Record<IGridBreakpoints, ThemedCssFunction<DefaultTheme>>;
  mediaQuery: string;
  columns: Record<IGridBreakpoints, number>;
  gutterWidth: Record<IGridBreakpoints, number>;
  paddingWidth: Record<IGridBreakpoints, number>;
  container: Record<IGridBreakpoints, number | string>;
  breakpoints: Record<IGridBreakpoints, number>;
}

Hi @michael-eightnine thanks for reporting. It really is a bug and I will fix it. I thought about the solution below, since we accept string, but only 'full'. What do you think?

how about

container: Record<IGridBreakpoints, number | 'full'>;

Done! Please check version 3.1.4 ๐Ÿš€