Skip to content

Conversation

@lc-soft
Copy link

@lc-soft lc-soft commented Aug 3, 2023

What kind of change does this PR introduce(这个 PR 引入了什么样的变化)?

  • Bugfix(修正错误)
  • Feature(新功能)
  • Refactor(重构)
  • Build-related changes(与构建相关的更改)
  • Other, please describe(其他,请描述):

Does this PR introduce a breaking change(这次 PR 引入了一个重大变化吗)?

  • Yes(是)
  • No(否)

If yes, please describe the impact and migration path for existing applications(如果是,请描述现有应用程序的影响和迁移路径):

The PR fulfills these requirements(PR 符合以下要求)

  • All tests are passing(所有测试都通过)

Other information(其他信息)

image

image

@CLAassistant
Copy link

CLAassistant commented Aug 3, 2023

CLA assistant check
All committers have signed the CLA.

@z979054461 z979054461 added the bug Something isn't working label Jan 22, 2024
@lc-soft lc-soft requested a review from z979054461 February 5, 2024 07:45
@z979054461
Copy link
Collaborator

关于这个问题,我觉得改这一句就好了,你看一下?
!Number.isNaN(Number(str)) => !Number.isNumber(str) && !Number.isNaN(Number(str))

let enums = enumStrs as Array<string | number>;

enumStrs.forEach((str) => {
if (!Number.isNaN(Number(str))) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

关于这个问题,我觉得改这一句就好了,你看一下? !Number.isNaN(Number(str)) => !Number.isNumber(str) && !Number.isNaN(Number(str))

image

@z979054461 Number.isNumber 不存在,用 typeof 代替?
!Number.isNumber(str) -> typeof str === 'string'

Copy link
Collaborator

@z979054461 z979054461 Feb 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不好意思说错了 本来想说lodash的(_.isNumber),看了下他的实现处理了Number的包装对象,这里讲道理应该不会出现包装对象。
这里可以用typeof str !== 'number' 也可以 !_.isNumber(str)
image

@z979054461 z979054461 closed this in e28758c Feb 7, 2024
z979054461 added a commit that referenced this pull request Feb 7, 2024
fix: #391 枚举包含数值时,生成的类型声明重复
@lc-soft lc-soft deleted the lc-soft-fix-enum-number-duplicate branch February 7, 2024 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants