Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
kapix-vite-plugin-vue-type-imports
Advanced tools
Enables you to import types and use them in your defineProps
and defineEmits
. Supports both Vue 2 and Vue 3.
⚠️ This Plugin is still in Development and there may be bugs. Use at your own risk.
# Install Plugin
npm i -D vite-plugin-vue-type-imports
// vite.config.ts
import { defineConfig } from 'vite'
import Vue from '@vitejs/plugin-vue'
import VueTypeImports from 'vite-plugin-vue-type-imports'
export default defineConfig({
plugins: [
Vue(),
VueTypeImports(),
],
})
// nuxt.config.ts
export default {
buildModules: [
'vite-plugin-vue-type-imports/nuxt',
]
}
// types.ts
export interface User {
username: string
password: string
avatar?: string
}
<script setup lang="ts">
import type { User } from '~/types'
defineProps<User>()
</script>
<template>...</template>
import * as Foo from 'foo'
are not supported.<script setup>
. Types defined in <script>
will be ignored.Enum
types will be converted to Union Types (e.g. type [name] = number | string
) , since Vue can't handle them right now.Illegal code:
export type Bar = Foo
export interface Foo {
foo: Bar
}
Alternatively, you can reference the types themselves in their own definitions
Acceptable code:
export type Bar = string
export interface Foo {
foo: Foo
bar: Foo | Bar
}
_1
and _2
is not recommended, because it may conflict with the plugin's transformation resultThese types may cause conflicts:
type Foo_1 = string
type Bar_2 = number
MIT License © 2021-PRESENT Jacob Clevenger
FAQs
vite-plugin-vue-type-imports
The npm package kapix-vite-plugin-vue-type-imports receives a total of 1 weekly downloads. As such, kapix-vite-plugin-vue-type-imports popularity was classified as not popular.
We found that kapix-vite-plugin-vue-type-imports demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.