Skip to content

Property 'options' does not exist on type 'VueConstructor<Vue>'.ts(2339) #337

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

Closed
praveenpuglia opened this issue May 31, 2019 · 2 comments
Closed

Comments

@praveenpuglia
Copy link

I am trying to write a component and export a plugin that installs that component globally but getting this error.

Property 'options' does not exist on type 'VueConstructor<Vue>'.ts(2339)

My component doesn't have anything special. Here's the plugin code.

import BCopy from './BCopy.vue';
import { VueConstructor } from 'vue';

const BCopyPlugin = {
  install(Vue: VueConstructor) {
    Vue.component(BCopy.options.name, BCopy);
  }
};
export default BCopy;
export { BCopyPlugin, BCopy };

More context coming from:

vuejs/vue-cli#4065

@ktsn
Copy link
Member

ktsn commented May 31, 2019

options is currently undocumented API so we don't declare it as TypeScript typings.
You need to annotate your component with any.

(Bcopy as any).options.name

@ktsn ktsn closed this as completed May 31, 2019
@praveenpuglia
Copy link
Author

Yeah. that's how I was getting it to work. Thought I may have done something stupid to not get the typing correct.

Thanks for clarification 👍

davidshq added a commit to davidshq-contribute/miqa that referenced this issue Apr 3, 2023
`options` is part of an undocumented API and thus no TS types have been defined, see: vuejs/vue-class-component#337
annehaley added a commit to OpenImaging/miqa that referenced this issue May 1, 2023
* Create .devcontainer/devcontainer.json

* Update gitconfig/exclusions; reorder dependencies

* Upgrading Webpack from 4.x to 5.x and some Vue CLI packages

- Vue CLI packages upgraded because older versions of the Vue CLI don't support 5.x
- Change 'port' to 'host' in Vue config (per Webpack 5.x requirements)
- Remove port from 'PUBLIC_ADDRESS' in .env.development so it will work with 'host'.

* Upgrading core-js to supported version and update ESLint and most dependents of ESLint

- Add Vuetify ESLint plugin. Note that this needs to stay at 1.x, the 2.x release is for Vuetify 3.

* Removing deprecated `babel-eslint` and replacing with `@babel/eslint-parser`

* Upgrade Vuetify from 2.6.3 to 2.6.14

* Upgrading Vuex, updating ESLint config

- Ensure that both `@vue/airbnb` and `@vue/typescript/recommended` are enabled
- Turn off ESLint rule regarding providing file extensions when importing

* Adding Jest for unit testing

* Adding TS import resolver to do away with errors when importing

For example '@/django' previously threw an error

* Minor linting changes

* Creating `storeConfig` that is consumed by `createDirectStore` and can be used for unit testing

Minor formatting updates, removing `rootActionContext`, `moduleActionContext`, `rootGetterContext`, `moduleGetterContext` as these appear to be unused

Note: We don't want to mount the actual MIQA store when performing tests, rather we want to create an instance specifically for testing. This isn't easy to accomplish when the store is exported as already implemented. By separating the declaration and implementation of the store (using `storeConfig`) `createDirectStore` can still export `store` as the MIQA store instance while Jest can also pull in the `storeConfig` to implement its own testing instance.

* Updating Jest configs

Note: Some of our node modules are not in the expected form. Usually Jest ignores the contents of the `node_modules` folder but in our case we need it to interact with a few directly, they are listed in the config file under `transformIgnorePatterns`

Note: Some file formats are not natively supported by Jest (e.g. most static assets), using `moduleNameMapper` we can have `jest-transform-stub` stub them out so they don't cause issues

* Adding basic unit test of `setCurrentVtkIndexSlices`

* Minor code refactoring, mainly using primitive types instead of object types

Note: See https://betterprogramming.pub/how-to-use-lowercase-types-for-primitives-and-objects-in-typescript-ddd00273849a

* Removing unneeded pug related dependencies

* Correcting tsconfig to target Vue 2 rather than 3, add `@vue/runtime-dom` which provides typing for Vue

* Removing `direct-vuex`, add additional type defs

* Minor code reformatting, specifying `lang="ts"` where appropriate

* Refactoring to standard Vuex style instead of `direct-vuex`

* Refactoring to standard Vuex style instead of `direct-vuex`, type `storeConfig` explicitly

* Update types

* Add missing properties/types to types, correct scans from having value `string[]` to `Scan`.

* Reorging types roughly by alphabetical order (User/Email at beginning, MIQAStore at end) to allow easier navigation between types

* Explicitly define permissions object

* Remove `MIQAStore` as type from `initState`, TODO regarding windowLocked

* Explicitly declaring `any` type on VRangeSlider

`options` is part of an undocumented API and thus no TS types have been defined, see: vuejs/vue-class-component#337

* Fix Vue shim, add `artifact_states` to `MIQAConfig` in store

* Refactoring `ControlPanel` to use Composition API and...

- Adding missing `lockCycle` to `data`
- Comment out non-existent catch handling

* Making `frame_evaluation` optional on `Frame`, adding `artifact_options` (optional) to `MIQAConfig` and...

Update target version in `tsconfig.json` to `2.7`

* Upgrading `vue` from `2.6.14` to `2.7.14` which allows us to remove `@vue/composition-api` and `@vue/runtime-dom`

* Minimal refactoring to remove dependency on `@vue/composition-api` from components and fixing incorrect syntax for `setTaskOverview` in `DecisionButtons.vue`

* Override TS depend version, upgrade vue router

* Refactor `hashCode` so conversion of boolean to number is explicit

* Add additional optional properties to `ResponseData` to eliminate TS complaints

* Adding types to various variables, ESLint fix

* Refactor keydown event listener in ControlPanel to use explicit types, use `tagName` instead of `type`

* Fix issue with app not running when using docker container for npm

* Add playwright and basic test

* Minor reformatting fixes for ESLint includes renaming a few components...

- Scan -> ScanView
- Projects -> ProjectsView

Disable Vuetify rules for the moment, changes required too disruptive

* Add keydown for accessibility

* Fix decisions on `ScanDecision` to be string not array, specify `last` in `Scan` has a type of `ScanDecision`

Ignoring complaints about multi-word component names for Vue plugins

Minor spelling corrections

* Adding properties to store that are utilized but not called

Ignore Navbar multi-world lint rule

* Correcting type of duration on WindowLock

* Move `snackbarAttach` and `promptAttach` into `mounted` to avoid TS complaining.

* Remove any, replace with explicit import of VRangeSlider

* Removing playwright tests on pull

* Removing pyppeteer and codecov from tests

* Removing with: related to codecov

* Removing unused ColorMaps, updating gitignore, old pyppeteer tox config

* Updating dependencies

* Minor code refactorings...

Primarily reformatting for consistency, ESLint compliance
Addition of some explanatory comments
Renaming ExperimentsView's scanState method's state variable to scanTaskState for clarity

* Refactoring store, Scan...

Renaming Vuex store action `getScan` to `loadScan`, this makes it consistent with other Vuex naming

Renaming method `loadScan` in `Scan.vue` to `swapToScan` to avoid naming conflict and replace call to `getScan` with `loadScan`

* Removing unused constants, extracting timeout constants into constants.ts, adding TS types to snackbar, renaming `reset` to `continueSession` in `TimeoutDialog`

* Minor refactoring of ControlPanel

switchLock parameters newExp and oldExp now newExperimentId, oldExperimentId

Additional comments

* Refactoring of DecisionButtons.vue...

- Removing `currentViewData` from `mapState` b/c (1) it's a getter and (2) it's included in `mapGetters`
- Renaming `dec` in `suggestedArtifacts` to `decision`
- Adding `AUTO_ADVANCE` flag which determines whether scans advance when a decision is made

* Minor refactoring for VtkViewer...

- Renaming slice parameter `value` to `newSlice`
- Adding type declaration in `takeScreenshot`

* Refactoring Vuex store...

- Adding a mutation-types.ts file which declares all the mutations we'll be using in the store
- Updating the mutations to standardized naming provided by mutation-types.ts
- Adding type for `proxyManager` param of `shrinkProxyManager` and `prepareProxyManager`
- Adding/updating comments throughout

* Refactoring Vuex store...

- Removing unused `wholeState` getter
- Refactoring `ADD_SCAN_DECISION` params from `currentScan`, `newDecision` to `currentScanId`, `newScanDecision`
- Refactoring `SET_FRAME_EVALUATION` param from `evaluation` to `frameEvaluation`
- Additional refactorings:
  - SET_LOADING_FRAME: value -> isLoading
  - SET_ERROR_LOADING_FRAME: value -> isErrorLoading
  - ADD_SCAN_FRAME: sid, id -> scanId, frameId
  - ADD_EXPERIMENT_SCANS: eid, sid -> experimentId, scanId
  - ADD_EXPERIMENT: id, value -> experimentId, experiment

* Refactoring Vuex store...

- Renaming variable `i` in `loadProject` to `experimentIndex`
- Renaming variable `j` in `loadProject` to `scanIndex`
- Renaming variable `k` in `loadProject` to `frameIndex`

* Refactoring Vuex store...

- Renaming `getArrayName` to `getArrayNameFromFilename`
- Renaming `getData` to `getImageData`
  - Renaming param `id` to `frameId`
- Renaming `loadFile` and `loadFileAndGetData` variable `fileP` to `cachedFile`
- Reduce nesting of async calls in `loadFileAndGetData`
- Renaming `i, j` params in `getNextFrame` to `experimentIndex, scanIndex`

* Updating calls to Vuex store to use new mutation standardized names, also fixing a problem where crosshair persistence and visibility where not being set correctly

Updating Vuex test to use new mutation names

* Updating mutation naming in a number of components

* Updating mutation naming in Projects, fixing sorting issue for `decisionToRating` in ExperimentsView

* Adding await to `this.refreshTaskOverview()`, `this.login`, `this.loadProject(this.currentProject)`, `store.dispatch('loadProject', newProject)` and `djangoRest.projects`

Updating mutation naming in django.ts

* Removing unused mutations setCurrentWindowWidth and setCurrentWindowLevel from Vuex store

* Remove unnecessary file additions

* Move playwright test to top-level CI

* Remove outdated vue-utilities directory

* Manage snackbar with App and store

* Make all components use composition api and similar structure

* Type fixes

* Update packages

* Behavior fixes

* Update github action versions for npm, tox, ci

* Updating package-lock

* Test update to CI

* New ci test

* Updating package-lock

* Disabling playwright github action

* Remove commented lines

* Remove ci.yml.old file

---------

Co-authored-by: Dave Mackey <[email protected]>
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

No branches or pull requests

2 participants