@lazycatcloud/wujie-typings

1.0.7 • Public • Published

无界类型定义

fork by https://gitee.com/jh_shot/wujie-typings

基于 Wujie 1.0.6 版本编写

  • Vue组件
    • vue <= 2.6 引用 v26.d.ts
    • vue 2.7 引用 v27.d.ts
    • vue >= 3 引用 v3.d.ts
  • JSX组件引用 jsx.d.ts
  • 全局变量引用 global.d.ts

tsconfig.json 示例:

{
  "compilerOptions": {
    "types": [
      "@lazycatcloud/wujie-typings/global",
      "@lazycatcloud/wujie-typings/jsx"
    ]
  }
}

自定义 bus 类型

tsconfig.json 中添加 bus_overwrite

{
  "include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
  "compilerOptions": {
    "types": [
      "vite-plugin-svg-icons/client",
      // ==================添加这两行
      "@lazycatcloud/wujie-typings/global",
      "@lazycatcloud/wujie-typings/bus_overwrite",
      // ==================
    ]
  },
}

然后自己覆盖掉 window.$wujie.bus

import { EventBus } from '@lazycatcloud/wujie-typings/bus_overwrite'

// 参考: https://github.com/developit/mitt
type RealBus = {
  'header:show'?: boolean
  'header:hide'?: boolean
}

declare global {
  interface Window {
    $wujie: {
      bus: EventBus<RealBus>
    }
  }
}

export {}

Readme

Keywords

Package Sidebar

Install

npm i @lazycatcloud/wujie-typings

Weekly Downloads

0

Version

1.0.7

License

MulanPSL2

Unpacked Size

15.5 kB

Total Files

11

Last publish

Collaborators

  • sugartoys
  • hanzhenfang
  • d1y
  • tzmax
  • squarefong
  • 178me
  • evanmeek
  • caozhenxiang
  • jeesk
  • luhuaei
  • fkxxyz
  • cursorzz
  • snyh