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

[Bug Report] No typings for import goTo function #9648

Closed
mlesin opened this issue Nov 10, 2019 · 8 comments · Fixed by #13812
Closed

[Bug Report] No typings for import goTo function #9648

mlesin opened this issue Nov 10, 2019 · 8 comments · Fixed by #13812
Assignees
Labels
E: goTo GoTo composable has workaround T: bug Functionality that does not work as intended/expected typescript
Milestone

Comments

@mlesin
Copy link

mlesin commented Nov 10, 2019

Environment

Vuetify Version: 2.1.9
Vue Version: 2.6.10
Browsers: Safari 13.0.3, Google Chrome, Mozilla Firefox, Safari, Microsoft Edge, Internet Explorer, Opera, Other
OS: Mac OS 10.14.6

Steps to reproduce

Just try to import goTo function from typescript:

import goTo from "vuetify/lib/services/goto";

Expected Behavior

successful import

Actual Behavior

TS Error:
Could not find a declaration file for module 'vuetify/lib/services/goto'

Reproduction Link

https://codesandbox.io/s/zen-taussig-3dwph

Other comments

Looks like type definition is missing.
Using this as workaround, in shims-vue.d.ts:

declare module "vuetify/lib/services/goto" {
  import Vue from "vue";
  export default function goTo<T extends string | number | HTMLElement | Vue>(target: T, options?: any): any;
}
@ghost ghost added the S: triage label Nov 10, 2019
@jacekkarczmarczyk jacekkarczmarczyk added typescript has workaround T: bug Functionality that does not work as intended/expected and removed S: triage labels Nov 10, 2019
@DieWebmacherin
Copy link

DieWebmacherin commented Dec 11, 2019

I have exactly the same error (I'm trying to use goTo with vue-router as described here: https://vuetifyjs.com/en/styles/scroll#using-with-router).
The thing is, I am not using Typescript. So none of the Typescript workarounds are useful for me (shims, compiler options).

Have you encountered this? Is this even possible or am I misunderstanding something, since this seems to be a TS specific error?

@KaelWD
Copy link
Member

KaelWD commented Dec 12, 2019

If you're getting that exact error then you are using typescript.

@bo-oz
Copy link

bo-oz commented Mar 28, 2020

I have a similar problem without Typescript. I just import the code in my router like this:

import goTo from 'vuetify/es5/services/goto';

This gives me the following error

index.js:24 Uncaught ReferenceError: exports is not defined
    at eval (index.js:24)
    at Module../node_modules/vuetify/es5/services/goto/index.js (app.js:8235)
    at __webpack_require__ (app.js:724)
    at fn (app.js:101)
    at eval (router.js:13)
    at Module../src/components/_helpers/router.js (app.js:13835)
    at __webpack_require__ (app.js:724)
    at fn (app.js:101)
    at eval (index.js?d5eb:1)
    at Module../src/components/_helpers/index.js (app.js:13823)

jacekkarczmarczyk added a commit that referenced this issue Jun 17, 2021
@jacekkarczmarczyk jacekkarczmarczyk self-assigned this Jun 17, 2021
@KaelWD KaelWD added this to the v2.5.x milestone Jun 18, 2021
KaelWD pushed a commit that referenced this issue Jun 22, 2021
@joyceben33
Copy link

Bug has resurfaced in new major version ^3.0.0

Environment

 "vue": "^3.2.47",
 "vuetify": "^3.1.13"

@Keropon
Copy link

Keropon commented Apr 10, 2023

Can confirm I encountered the bug in

"vue": "^3.2.47",
"vuetify": "^3.1.11"

@Onyoursix
Copy link

I'm also getting this bug with nuxt
"nuxt": "^3.2.3", "vuetify": "^3.0.1",

@etienne-monier
Copy link

Me too. I use TS.

vue@3.3.4
vuetify@3.3.8

@etienne-monier
Copy link

Can someone detail how to use the workaround?

@johnleider johnleider added E: goTo GoTo composable and removed goTo labels Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E: goTo GoTo composable has workaround T: bug Functionality that does not work as intended/expected typescript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants