Skip to content

Commit

Permalink
example
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalgermain committed Dec 12, 2023
1 parent 924e913 commit fc47dec
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"private": true,
"packageManager": "pnpm@8.11.0",
"scripts": {
"build": "vite-ssg build",
"build:types": "vue-tsc --project ./tsconfig.declaration.json",
"build": "vite-ssg build && pnpm build:types",
"dev": "vite --port 3333 --open",
"lint": "eslint .",
"preview": "vite preview",
Expand Down
1 change: 1 addition & 0 deletions src/auto-imports.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ declare global {
declare global {
// @ts-ignore
export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
import('vue')
}
// for vue template auto import
import { UnwrapRef } from 'vue'
Expand Down
6 changes: 6 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
import type { ViteSSGContext } from 'vite-ssg'

export type UserModule = (ctx: ViteSSGContext) => void

// This triggers error TS4081: Exported type alias 'NumberRef' has or is using private name 'Ref'.
export type NumberRef = Ref<number>

// This triggers error TS4025: Exported variable 'count' has or is using private name 'Ref'.
export const count: Ref<number> = ref(1)
8 changes: 8 additions & 0 deletions tsconfig.declaration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "dist"
}
}
6 changes: 5 additions & 1 deletion uno.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
type UserConfig,
defineConfig,
presetAttributify,
presetIcons,
Expand All @@ -9,7 +10,10 @@ import {
transformerVariantGroup,
} from 'unocss'

export default defineConfig({
// Had to add this to prevent error TS2742: The inferred type of 'default' cannot be
// named without a reference to '.pnpm/@unocss+core@0.58.0/node_modules/@unocss/core'.
// This is likely not portable. A type annotation is necessary.
export default <UserConfig>defineConfig({
shortcuts: [
['btn', 'px-4 py-1 rounded inline-block bg-teal-700 text-white cursor-pointer !outline-none hover:bg-teal-800 disabled:cursor-default disabled:bg-gray-600 disabled:opacity-50'],
['icon-btn', 'inline-block cursor-pointer select-none opacity-75 transition duration-200 ease-in-out hover:opacity-100 hover:text-teal-600'],
Expand Down

0 comments on commit fc47dec

Please sign in to comment.