Skip to content

Commit

Permalink
Merge pull request #18 from wtto00/dev
Browse files Browse the repository at this point in the history
修复moduleResolution配置为bundler和node16时,类型无法识别的问题
  • Loading branch information
wtto00 authored Sep 1, 2023
2 parents af10ea3 + 1868566 commit 91c8543
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 8 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Check Test

on:
pull_request:
types: [opened, reopened, synchronize]

jobs:
type-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16

- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install

- name: Run Test
run: pnpm test
22 changes: 22 additions & 0 deletions .github/workflows/close-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Close inactive issues
on:
schedule:
- cron: '30 1 * * *'

jobs:
close-issues:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v5
with:
days-before-issue-stale: 30
days-before-issue-close: 14
stale-issue-label: 'stale'
stale-issue-message: 'This issue is stale because it has been open for 30 days with no activity.'
close-issue-message: 'This issue was closed because it has been inactive for 14 days since being marked as stale.'
days-before-pr-stale: -1
days-before-pr-close: -1
repo-token: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion .github/workflows/npm-publish-github-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
name: Version Check
steps:
- uses: actions/checkout@v2.4.2
- uses: actions/checkout@v3
# 检查npm包的版本号和本地packages.json的版本号是否重复
# https://github.com/marketplace/actions/version-check
- id: cpv
Expand Down Expand Up @@ -72,3 +72,4 @@ jobs:
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NPM_CONFIG_PROVENANCE: true
2 changes: 1 addition & 1 deletion jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"moduleResolution": "nodenext",
"allowSyntheticDefaultImports": true,
"jsx": "preserve",
"checkJs": true,
Expand Down
6 changes: 3 additions & 3 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ declare module WX {
* 用户取消时:"xxx:cancel",其中xxx为调用的接口名
* 调用失败时:其值为具体错误信息
*/
type CommonApiOptionsCallbackParams<T extends Record = {}> = {
type CommonApiOptionsCallbackParams<T extends object = {}> = {
[key: string]: any
errMsg: string
} & T
Expand All @@ -150,7 +150,7 @@ declare module WX {
* T: success回调函数的参数
* D: complete回调函数的参数
*/
interface CommonApiOptions<T extends Record = {}, D extends Record = {}> {
interface CommonApiOptions<T extends object = {}, D extends object = {}> {
/**
* 接口调用成功时执行的回调函数。
*/
Expand Down Expand Up @@ -710,7 +710,7 @@ declare module WX {
/**
* 小程序路由跳转参数
*/
interface MPRouterOptions<T = void> extends CommonApiOptions<T> {
interface MPRouterOptions<T extends object = {}> extends CommonApiOptions<T> {
/**
* 需要跳转的应用内非 tabBar 的页面的路径 (代码包路径), 路径后可以带参数。
* 参数与路径之间使用 ? 分隔,参数键与参数值用 = 相连,不同参数用 & 分隔;
Expand Down
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "@wtto00/jweixin-esm",
"version": "1.6.0-3",
"version": "1.6.0-4",
"description": "微信JSSDK ESM模块 附带TS类型以及详细注释",
"type": "module",
"exports": "./lib/jweixin-1.6.0.esm.js",
"module": "./lib/jweixin-1.6.0.esm.js",
"types": "lib/index.d.ts",
"files": [
"lib"
Expand Down Expand Up @@ -34,5 +34,11 @@
"bugs": {
"url": "https://github.com/wtto00/jweixin-esm/issues"
},
"homepage": "https://github.com/wtto00/jweixin-esm#readme"
"homepage": "https://github.com/wtto00/jweixin-esm#readme",
"scripts": {
"test": "tsc --traceResolution ./lib/index.d.ts"
},
"devDependencies": {
"typescript": "^5.2.2"
}
}
18 changes: 18 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 91c8543

Please sign in to comment.