nuxt-community/dayjs-module

TS2345: Argument of type 'string' is not assignable to parameter of type

MaxNvk opened this issue · 3 comments

Hi there! I have bug with types when i'm try to use $dayjs inside of vuex mutations (example in photo below). when i'm assign value directly, without using of $dayjs module, error dissapears.
image

my tsconfig.json file includes:

{
  "compilerOptions": {
    "target": "ES2018",
    "module": "ESNext",
    "moduleResolution": "Node",
    "lib": ["ESNext", "ESNext.AsyncIterable", "DOM", "DOM.Iterable"],
    "resolveJsonModule": true,
    "esModuleInterop": true,
    "allowJs": true,
    "sourceMap": true,
    "strict": true,
    "jsx": "preserve",
    "noEmit": true,
    "declaration": true,
    "noUnusedLocals": false,
    "noUnusedParameters": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true,
    "suppressImplicitAnyIndexErrors": true,
    "allowSyntheticDefaultImports": true,
    "skipLibCheck": true,
    "experimentalDecorators": true,
    "baseUrl": ".",
    "paths": {
      "~/*": ["./*"],
      "@/*": ["./*"]
    },
    "types": ["@nuxt/types", "@nuxtjs/dayjs", "@nuxtjs/auth-next", "@nuxtjs/axios", "@types/node", "nuxt-i18n", "@nuxt/image"]
  },
  "exclude": ["node_modules", ".nuxt", "dist", "stories"]
}

Have any ideas why it occurs?

@MaxNvk
What state.offer.data.availableForm type is?

@potato4d
It has type availableForm: string | null;

thank you.
Cloud you share the detailed source code with the codesandbox URL?