jpush / jpush/jpush-react-native

Typescript环境下无法执行init方法

Open
#879 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.4k
Forks
348
PR merge metrics
No merged PRs in 30d

Description

你的运行环境

  • 插件版本: jcore 2.0.2 jpush 2.9.1
  • react-native 版本: 0.64.1

期望效果

Demo中App.js有如下init用法:
https://github.com/jpush/jpush-react-native/blob/2aa7f9022b14df8a1b2f822edcd94f944707bb4f/example/App.js#L55

实际效果

在TypeScript环境下,jpush-react-native包中的index.d.ts对init方法有如下参数类型定义:
https://github.com/jpush/jpush-react-native/blob/c33ebfcef15467c8fde598e9faf8fd70b6b9ccf2/index.d.ts#L57-L67

容易看出,Demo中的init方法调用在TypeScript环境下是无法跑通的,存在两个问题:

  • channel参数不存在,而有一个叫titchannelle的参数未被传递
  • production参数只接受boolean类型,却传了数值1

另外index.d.ts中对init方法的注释与实际的类型定义是不匹配的——注释与Demo里的用法一致,而与TS定义冲突,两段话各说各的,不知道该听谁的

重现步骤

不需要

Debug logs

不需要

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Compare the init usage in example/App.js at the linked line with its declaration and comments in index.d.ts at the linked lines. Determine which parameter names and value types represent the intended API, then make the declaration and documentation consistent and verify that the example usage is accepted by TypeScript.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
mobile
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.