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] Wrong Typescript definition for theme #7964

Closed
macdows opened this issue Jul 24, 2019 · 0 comments · Fixed by #7878
Closed

[Bug Report] Wrong Typescript definition for theme #7964

macdows opened this issue Jul 24, 2019 · 0 comments · Fixed by #7878
Assignees
Labels
Service: Theme T: bug Functionality that does not work as intended/expected typescript
Milestone

Comments

@macdows
Copy link

macdows commented Jul 24, 2019

Environment

Vuetify Version: 2.0.0
Last working version: 1.5.16
Vue Version: 2.6.10
Browsers: Chrome 75.0.3770.142
OS: Linux x86_64

Steps to reproduce

Open main.ts in the codesandbox => tslint error

Expected Behavior

No linting error

Actual Behavior

Type '{ base: string; darken1: string; }' is missing the following properties from type 'VuetifyParsedThemeItem': lighten5, lighten4, lighten3, lighten2, and 4 more. ts(2345)

Reproduction Link

https://codesandbox.io/s/vue-template-hok88

Other comments

In the VuetifyParsedThemeItem definition all the lighten and darken properties are required.
It means that the following example from the official documentation does not work :

// src/plugins/vuetify/theme.js

import colors from 'vuetify/lib/util/colors'

export default {
  primary: {
    base: colors.purple.base,
    darken1: colors.purple.darken2,
  },
  secondary: colors.indigo,
  // All keys will generate theme styles,
  // Here we add a custom `tertiary` color
  tertiary: colors.pink.base,
}

Shouldn't the lighten and darken variants be optional so you can set only the ones you need ?
Like so :

export interface VuetifyParsedThemeItem {
  [name: string]: string

  base: string
  lighten5?: string
  lighten4?: string
  lighten3?: string
  lighten2?: string
  lighten1?: string
  darken1?: string
  darken2?: string
  darken3?: string
  darken4?: string
}
@ghost ghost added the S: triage label Jul 24, 2019
@johnleider johnleider added T: bug Functionality that does not work as intended/expected and removed S: triage labels Jul 26, 2019
@johnleider johnleider added this to the v2.0.x milestone Jul 26, 2019
johnleider pushed a commit that referenced this issue Sep 3, 2019
* fix(types): avoid importing from src

fixes #7040
fixes #7387
fixes #7964

* fix(types): don't use Dictionary<T>

* fix(types): update for v2

* refactor: rename breakpoint interface
johnleider pushed a commit that referenced this issue Sep 20, 2019
* fix(types): avoid importing from src

fixes #7040
fixes #7387
fixes #7964

* fix(types): don't use Dictionary<T>

* fix(types): update for v2

* refactor: rename breakpoint interface
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Service: Theme T: bug Functionality that does not work as intended/expected typescript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants