Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support TypeScript #129

Closed
camcam2605 opened this issue Aug 11, 2023 · 3 comments
Closed

Support TypeScript #129

camcam2605 opened this issue Aug 11, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@camcam2605
Copy link

Can support TypeScript for this library ?

@karolis-sh karolis-sh added the enhancement New feature or request label Sep 9, 2023
@MickL
Copy link

MickL commented Nov 14, 2023

There are currently two problems:

  1. Eslint complains that require() is not allowed
  2. When using import instead the compiler is complaining that not declaration file is found
Bildschirmfoto 2023-11-14 um 17 45 42

@karolis-sh

@karolis-sh
Copy link
Owner

Typescript types have just been added with 5.1.0 version.

@MickL yes, use import, did a quick test this should work:

tailwind.config.ts

import tailwindBootstrapGrid from "tailwind-bootstrap-grid";

/** @type {import('tailwindcss').Config} */
export default {
  content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"],
  theme: {
    extend: {},
  },
  corePlugins: {
    container: false,
  },
  plugins: [
    tailwindBootstrapGrid({
      containerMaxWidths: {
        sm: "540px",
        md: "720px",
        lg: "960px",
        xl: "1140px",
      },
    }),
  ],
};

@MickL
Copy link

MickL commented Nov 28, 2023

Thanks!
Maybe update the readme to also show a TS config?

import tailwindBootstrapGrid from 'tailwind-bootstrap-grid';
import type { Config } from 'tailwindcss';

export default <Partial<Config>>{
  plugins: [tailwindBootstrapGrid({})],
};

I created a PR to add it to the Readme :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants