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

feat: implemented Typescript definitions #28

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"repository": "nuxt-community/fontawesome-module",
"license": "MIT",
"main": "lib/module.js",
"types": "types/index.d.ts",
"contributors": [
"vaso2 <[email protected]>"
],
Expand Down
57 changes: 57 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
declare module "@nuxt/types" {
interface NuxtConfig {
/**
* Nuxt FontAwesome module
* https://github.com/nuxt-community/fontawesome-module
*/
fontawesome?: {
/**
* Default: `"FontAwesomeIcon"`
* Change component name. Eg set to fa to use <fa icon="" ... />.
* Also see [suffix](https://github.com/nuxt-community/fontawesome-module#suffix)
* It's strongly recommended to use [PascalCase](https://vuejs.org/v2/style-guide/#Component-name-casing-in-templates-strongly-recommended) for component names
*/
component?: string
/**
* Default: `true`
* Boolean to indicate if the layers component should be registered globally.
* Name of the component will be `${options.component}-layers, fe <fa-layers ... />`
*/
userLayers?: boolean
/**
* Default: `true`
* Boolean to indicate if the layers component should be registered globally. Name of the component will be the `${options.component}-layers-text, fe <fa-layers-text ... />`
*/
useLayersText?: boolean
/**
* Which icons you will use. Set tue `true` to import everything.
* FontAwesome [currently](https://fontawesome.com/how-to-use/on-the-web/referencing-icons/basic-use) supports 5 icon styles of which 3 are freely available (partially).
*/
icons: Icons
/**
* See `icons` for how to use, but always uses pro imports.
*/
proIcons: Icons
/**
* Default: `true`
* If the module should automatically add the fontawesome styles to the global css config. It works by unshifting @fortawesome/fontawesome-svg-core/styles.css onto the nuxt.options.css property.
*/
addCss?: boolean
/**
* Default: `false`
* Boolean whether to append -icon to the icon component name.
* This option exists as the component name option is also used for the layer components and you might not want to add `-icon` to those
*/
suffix?: boolean
}
}

interface Icons {
solid?: FontAwesomeIcon[] | true
regular?: FontAwesomeIcon[] | true
light?: FontAwesomeIcon[] | true
duotone?: FontAwesomeIcon[] | true
brands?: FontAwesomeIcon[] | true
}
type FontAwesomeIcon = string | [string, string]
}