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

Conversation

gekkedev
Copy link

@gekkedev gekkedev commented Jan 22, 2021

aligns with the readme file, but left out deprecated property imports
fixes #27
not sure how to map the fontawesome key directly - could we somehow create an interface that automatically extends the nuxt configuration by this property?

aligns with the readme file, but left out deprecated property `imports`
@gekkedev gekkedev changed the title added type definitions feat: implemented Typescript definitions Jan 22, 2021
@gekkedev gekkedev marked this pull request as ready for review January 22, 2021 12:42
@pimlie
Copy link
Member

pimlie commented Jan 27, 2021

@gekkedev Have a look at how the i18n module adds a config key to the nuxt options: https://github.com/nuxt-community/i18n-module/blob/master/types/vue.d.ts#L44

And thanks for working on this btw!

@gekkedev
Copy link
Author

gekkedev commented Feb 3, 2021

@pimlie I've tried to this to the type definitions:

declare module '@nuxt/types' {
    interface NuxtOptions {
        fontawesome?: NuxtFontawesomeOptions
    }
}

Unfortunately it doesn't get recognized. What did I forget?

@gekkedev
Copy link
Author

gekkedev commented Mar 8, 2021

Forgot the entry in tsconfig.json as the other library suggests as well but unfortunately that did not help. It might be that I have too many chaotic imports or that my IDE is not refreshing the imports often enough (or something is wrong with all the declaration merging coming from different libraries). Any idea what to change here?

@pimlie
Copy link
Member

pimlie commented Mar 28, 2021

@gekkedev I think the issue might be a missing types entry in pkg.json in the stable package? Maybe your editor doesnt pick that up correctly for your local dev. I assume you yarn linked nuxt-fontawesome into your nuxt project?.

(via declaration merging, still not working on my machine)
@gekkedev
Copy link
Author

I adjusted the module declaration because previously I had no idea about declaration merging (and am still unsure if this is entirely correct). The types entry is there if this is what you mean. Also added "@nuxtjs/fontawesome" into types in my local tsconfig.json; exactly as seen with another Nuxt package. Is there something I might have forgotten or just a technical (IDE) issue on my side?

@gekkedev
Copy link
Author

I added an enclosing config key that I forgot and it works for me - however the type definitions only get applied when the file is open in VSCode, not when the file is closed. I restarted TSServer & Vetur - maybe you know what has to be done @pimlie ?

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

Successfully merging this pull request may close these issues.

Typescript support
2 participants