Skip to content
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

Type support added #1781

Open
wants to merge 3 commits into
base: beta
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/*.d.ts
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
],
"main": "./dist/vue-select.umd.js",
"module": "./dist/vue-select.es.js",
"types": "./dist/src/index.d.ts",
"exports": {
".": {
"import": "./dist/vue-select.es.js",
Expand Down Expand Up @@ -48,6 +49,7 @@
"vue": "3.x"
},
"devDependencies": {
"@babel/types": "^7.22.5",
"@rushstack/eslint-patch": "^1.2.0",
"@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^8.0.7",
Expand All @@ -73,6 +75,7 @@
"semantic-release": "^19.0.5",
"typescript": "^4.9.3",
"vite": "^3.2.4",
"vite-plugin-dts": "^2.3.0",
"vitest": "^0.25.3",
"vue": "^3.2.45",
"vue-tsc": "^1.0.10"
Expand Down
5 changes: 5 additions & 0 deletions shims-vue.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare module '*.vue' {
import type { DefineComponent } from 'vue'
const component: DefineComponent<Record<string, unknown>, Record<string, unknown>, any>
export default component
}
21 changes: 11 additions & 10 deletions src/components/Select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -135,19 +135,20 @@
</div>
</template>

<script>
import pointerScroll from '@/mixins/pointerScroll.js'
import typeAheadPointer from '@/mixins/typeAheadPointer.js'
import ajax from '@/mixins/ajax.js'
import childComponents from '@/components/childComponents.js'
import appendToBody from '@/directives/appendToBody.js'
import sortAndStringify from '@/utility/sortAndStringify.js'
import uniqueId from '@/utility/uniqueId.js'
<script lang="ts">
import pointerScroll from '@/mixins/pointerScroll.ts'
import typeAheadPointer from '@/mixins/typeAheadPointer.ts'
import ajax from '@/mixins/ajax.ts'
import childComponents from '@/components/childComponents.ts'
import appendToBody from '@/directives/appendToBody.ts'
import sortAndStringify from '@/utility/sortAndStringify.ts'
import uniqueId from '@/utility/uniqueId.ts'

/**
* @name VueSelect
*/
export default {
import { defineComponent } from 'vue'
export default defineComponent({
components: { ...childComponents },

directives: { appendToBody },
Expand Down Expand Up @@ -1362,5 +1363,5 @@ export default {
}
},
},
}
})
</script>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 0 additions & 5 deletions src/mixins/index.js

This file was deleted.

5 changes: 5 additions & 0 deletions src/mixins/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import ajax from '@/mixins/ajax.ts'
import pointer from '@/mixins/typeAheadPointer.ts'
import pointerScroll from '@/mixins/pointerScroll.ts'

export default { ajax, pointer, pointerScroll }
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": "@vue/tsconfig/tsconfig.web.json",
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
"include": ["env.d.ts", "shims-vue.d.ts", "src/**/*", "src/**/*.vue"],
"exclude": ["tests"],
"compilerOptions": {
"composite": true,
Expand Down
10 changes: 7 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { resolve } from 'path'
import { fileURLToPath, URL } from 'url'

import dts from 'vite-plugin-dts'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
plugins: [vue(), dts({
staticImport: true,
skipDiagnostics: false,
insertTypesEntry: true
})],
publicDir: false,
resolve: {
alias: {
Expand All @@ -17,7 +21,7 @@ export default defineConfig({
build: {
target: 'es2015',
lib: {
entry: resolve(__dirname, 'src/index.js'),
entry: resolve(__dirname, 'src/index.ts'),
name: 'vue-select',
fileName: (format) => `vue-select.${format}.js`,
},
Expand Down