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

Oruga-next should declare its types soemwhere #68

Closed
alci63 opened this issue Dec 19, 2020 · 1 comment
Closed

Oruga-next should declare its types soemwhere #68

alci63 opened this issue Dec 19, 2020 · 1 comment
Labels

Comments

@alci63
Copy link

alci63 commented Dec 19, 2020

Description

When using vue-cli with Typescript, after installing oruga-next with npm, importing from '@oruga-ui/oruga-next' fails:

Could not find a declaration file for module '@oruga-ui/oruga-next'. '/home/franck/devel/git-repositories/tethys/node_modules/@oruga-ui/oruga-next/dist/cjs/index.js' implicitly has an 'any' type.

To work this around, I had to "provide custom typings about this module".

Create a folder named "typings-custom" at the root of your project
Reference the content of this folder in your tsconfig.json:

"include": [
"./typings-custom/**/*.ts"
]

Create a file with this exact name: foo.d.ts [foo = the name of the module] with the content:

declare module 'foo'

Your TypeScript code should now compile, albeit with NO type information (TypeScript consider the foo module of type "any").

(see https://stackoverflow.com/questions/38224232/how-to-consume-npm-modules-from-typescript==

Why Oruga need this feature

As Vue 3 improves Typescript compatibility, more and more users could opt for TypeScript. Having Oruga-next work out of the box would be a cool feature. Moreover, good typing could improve code quality.

@jtommy
Copy link
Member

jtommy commented Dec 19, 2020

@alci63 thanks! We are working on a better support and probably we are going to rewrite vue 3 code using TS natively

@jtommy jtommy added the vue 3 label Dec 19, 2020
@jtommy jtommy closed this as completed Feb 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants