jackocnr / intl-tel-input

A JavaScript plugin for entering and validating international telephone numbers. React and Vue components also included.
https://intl-tel-input.com
MIT License
7.62k stars 1.94k forks source link

Vue import trouble: cannot find module or its corresponding type declarations #1841

Open seasonedtofu opened 1 week ago

seasonedtofu commented 1 week ago

image

Hi, I am having trouble trying to import the Vue component and am not sure if I am doing it correctly.

I am getting a Cannot find module 'intl-tel-input/vue' or its corresponding type declarations. error. I have also tried importing just like from the demo/readme with import IntlTelInput from 'intl-tel-input/vueWithUtils'; and same issue.

The version I am on is 24.6.0

Is there any way to fix this? Here is my tsconfig.json below:

{
  "compilerOptions": {
    "target": "ESNext",
    "module": "ESNext",
    "strict": true,
    "jsx": "preserve",
    "importHelpers": true,
    "moduleResolution": "node",
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "sourceMap": true,
    "baseUrl": ".",
    "paths": {
      "@/*": ["./src/*"],
    },
    "lib": [
      "ESNext",
      "dom",
      "dom.iterable",
      "scripthost"
    ],
  },
  "references": [
    {
      "path": "./tsconfig.node.json"
    }
  ],
  "include": [
    "src/**/*.ts",
    "src/**/*.tsx",
    "src/**/*.vue"
  ],
  "exclude": [
    "node_modules",
    "packages/**/dist/**"
  ]
}
jackocnr commented 1 week ago

Unfortunately, the vue component doesn't have types yet: https://github.com/jackocnr/intl-tel-input/issues/1794

As I say in that thread, the Vue Component is actually very simple - it should be easy to add them. I don't have time to implement this myself, but would welcome a pull request.