GithubHelp home page GithubHelp logo

Comments (11)

RayGuo-ergou avatar RayGuo-ergou commented on July 20, 2024

Seems like a typescript issue to me (tsconfig.json).

from language-tools.

FanilZarip avatar FanilZarip commented on July 20, 2024

Seems like a typescript issue to me (tsconfig.json).

I tried updating typescript in a project created with npm create [email protected]. Library types work.
But don't work with npm create vue@latest where tsconfig is different from tsconfig which is created in npm create with [email protected] tsconfig

Have you tried building a simple library with typescript types on the latest version of Vue?

from language-tools.

RayGuo-ergou avatar RayGuo-ergou commented on July 20, 2024

I copied the tsconfig files i used to work with building an UI lib. Also you don't have to pass --build to build, I think it will build the references first. But your references seems only for development, e.g. testing and vite config file.

Here: FanilZarip/test-lib-build@lib_build_with_dts...RayGuo-ergou:test-lib-build:lib_build_with_dts

from language-tools.

FanilZarip avatar FanilZarip commented on July 20, 2024

I copied the tsconfig files i used to work with building an UI lib. Also you don't have to pass --build to build, I think it will build the references first. But your references seems only for development, e.g. testing and vite config file.

Here: FanilZarip/test-lib-build@lib_build_with_dts...RayGuo-ergou:test-lib-build:lib_build_with_dts

Hi!

I've created a library with your configs and trying to use it in a new Vue project. But there are still type errors when using it.

My repo with test library. I pack it with npm pack and install locally from /src/local_repo
https://github.com/FanilZarip/test_use_own_library

And type errors screen.

errors

from language-tools.

RayGuo-ergou avatar RayGuo-ergou commented on July 20, 2024

You are building with --build again. You should understand how it and tsconfig references works first.

I also recommend you to start a new project with vite create.

https://vitejs.dev/guide/

from language-tools.

FanilZarip avatar FanilZarip commented on July 20, 2024

You are building with --build again. You should understand how it and tsconfig references works first.

I also recommend you to start a new project with vite create.

https://vitejs.dev/guide/

Here I build it with your tsconfig and pack with npm pack
https://github.com/FanilZarip/test-lib-build/tree/lib_build_with_dts

Then (github link below) I use this npm package and run type checking and language-tools do not show types. I create vue project with vuejs recommended way. npm create vue@latest. It is clear project with ts. And i wait that config will run well from box.

Also if I run just vue-tsc --watch, yes it is do not show any type errors. But if i use uncorrect props value type it also do not show type error. In my screen I use BaseButton with type="out" instead of "outline" and vscode and vue-tsc do not show errors for types

https://github.com/FanilZarip/test_use_own_library/tree/test_own_lib

Yes I am beginner at TS and Library building.

from language-tools.

FanilZarip avatar FanilZarip commented on July 20, 2024

I wait correct types "primary" | "outline"

image

from language-tools.

RayGuo-ergou avatar RayGuo-ergou commented on July 20, 2024

image
image
image

Not really sure what you mean but all working fine on my side. ( I also used pnpm create vue@latest to create the project)

Maybe you missed this, in your ui lib's package.json. You need to declare where the type file is.

  "exports": {
    ".": {
+      "types": "./dist/types/index.d.ts",
      "import": "./dist/testui.es.ts",
      "require": "./dist/testui.umd.ts"
    },
    "./styles": "./dist/style.css"
  },

from language-tools.

RayGuo-ergou avatar RayGuo-ergou commented on July 20, 2024

image
image

also tried your repo, works fine, guessing you just missed that part.
see: https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html
for more information.

from language-tools.

FanilZarip avatar FanilZarip commented on July 20, 2024

image image

also tried your repo, works fine, guessing you just missed that part. see: https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html for more information.

Yes, You are right. It was vite-plugin-dts problem with default tsconfig

Thanks!

from language-tools.

FanilZarip avatar FanilZarip commented on July 20, 2024

qmhc/vite-plugin-dts#323

vite-plugin-dts error explained here

from language-tools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.