-
Notifications
You must be signed in to change notification settings - Fork 34
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
VSCode not recognizing the types after packaging by vue-tsc #474
Comments
Here is a Demo code zip package that can quickly reproduce the problem. After downloading, open with VSCode and run |
Hello it's probably a path resolution issue. I open a PR to try to solve it (#475). Could you try to install the following snapshot version and let me know if it works?
|
@dwightjack Good, after installing this snapshot version, everything is fine after building. 👍👍👍 Thanks very much. |
It seems that I have a way of doing this, the way below. Is this approach the best practice? /**
* Returns a prop type definition for a color value.
*
* @returns The prop type definition.
*/
export function color<T extends string = string>() {
return toValidableType<T>(
"color",
{
type: String as unknown as PropType<T>,
validator(value) {
const isValid = colord(value).isValid();
if (!isValid) {
console.warn(`color - "${value}" is not a color`);
}
return isValid;
},
},
);
} |
@ilxqx It is not so easy to customize the warning of the custom validator because it's managed by Vue internals. I think your solution is the simplest and most effective one. A probably more elegant but complex approach would be to set a custom warning handler. The downsides are:
|
👍👍👍Nice, thanks very much |
@dwightjack Hi, can a new release be made for this issue? Thanks. |
@ilxqx sorry for the delay. Released as |
Library version
5.1.2
Vue.js version
3.4.31
Question
![image](https://private-user-images.githubusercontent.com/18739624/344478455-3d348739-c193-45a4-8b58-8b0bf60d99b0.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjEzMTkyMzQsIm5iZiI6MTcyMTMxODkzNCwicGF0aCI6Ii8xODczOTYyNC8zNDQ0Nzg0NTUtM2QzNDg3MzktYzE5My00NWE0LThiNTgtOGIwYmY2MGQ5OWIwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzE4VDE2MDg1NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWM5MWNjYjdkY2ZiODgzYmNkMzViYjAyNDFkODAwNzI5OTA0NTJkNjgzN2MwMjYyODYyNWQ5NmZkZGMyYjYyZDImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.A-HifFC8_j7kEZmXozQVGUv0oMO0IVBk_jJv3w3GT2I)
Hi, Thanks very much for your work.
Here is my Button component props definition code snapshot:
My build types command:
vue-tsc -p ./tsconfig.build.json
.tsconfig.build.json:
My tsconfig.app.json:
The Button component props type definition file after building:
Here is the snapshot:
![image](https://private-user-images.githubusercontent.com/18739624/344478868-31cb66c4-45ce-4b21-b981-2e0c8701387c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjEzMTkyMzQsIm5iZiI6MTcyMTMxODkzNCwicGF0aCI6Ii8xODczOTYyNC8zNDQ0Nzg4NjgtMzFjYjY2YzQtNDVjZS00YjIxLWI5ODEtMmUwYzg3MDEzODdjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzE4VDE2MDg1NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY1YjI3YWQyMjQ2Nzk5YmI3MmUzOTZmMzM3MzAxODEyZTUyMjM3YmY4NzU3NmRlMjYyZDRkOWE0ODYwNzFlMzUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.sZeUkXbakGWzfBTr8PyjWP8ZTRnD__lUOTwKjLJ4UbY)
Restarting VSCode does not solve this problem. This makes me very confused, can you help me? Thanks in advance 🙏🙏🙏.
The text was updated successfully, but these errors were encountered: