r-sugi / nextjs-tdd-template

https://nextjs-tdd-templatestorybook-rsugis-projects.vercel.app
0 stars 0 forks source link

add: as const satisfies ใซใ™ใ‚‹ #185

Closed r-sugi closed 2 months ago

r-sugi commented 2 months ago

User description

147


PR Type

enhancement


Description


Changes walkthrough ๐Ÿ“

Relevant files
Enhancement
activeMember.ts
Use `as const satisfies` for type assertion in `activeMember`

mocks/fixtures/activeMember.ts
  • Changed import statement to use type keyword.
  • Modified activeMember to use as const satisfies syntax.
  • Removed explicit type annotation for activeMember.
  • +11/-11 

    ๐Ÿ’ก PR-Agent usage: Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    vercel[bot] commented 2 months ago

    The latest updates on your projects. Learn more about Vercel for Git โ†—๏ธŽ

    Name Status Preview Comments Updated (UTC)
    nextjs-tdd-template_storybook โœ… Ready (Inspect) Visit Preview ๐Ÿ’ฌ Add feedback Sep 10, 2024 1:48am
    github-actions[bot] commented 2 months ago

    PR Reviewer Guide ๐Ÿ”

    โฑ๏ธ Estimated effort to review: 2 ๐Ÿ”ต๐Ÿ”ตโšชโšชโšช
    ๐Ÿงช No relevant tests
    ๐Ÿ”’ No security concerns identified
    โšก Key issues to review

    Type Safety
    `as const satisfies ActiveMember` ใฎไฝฟ็”จใซใ‚ˆใ‚Šใ€ๅž‹ๅฎ‰ๅ…จๆ€งใŒๅ‘ไธŠใ—ใฆใ„ใพใ™ใŒใ€`ActiveMember` ๅž‹ใŒๆญฃใ—ใๆบ€ใŸใ•ใ‚Œใฆใ„ใ‚‹ใ‹ใฎ็ขบ่ชใŒๅฟ…่ฆใงใ™ใ€‚็‰นใซใ€`birthday` ใจ `createdAt` ใฎๅž‹ใŒ `Date` ใงใ‚ใ‚‹ใ“ใจใ‚’็ขบ่ชใ—ใฆใใ ใ•ใ„ใ€‚
    github-actions[bot] commented 2 months ago

    PR Code Suggestions โœจ

    CategorySuggestion                                                                                                                                    Score
    Possible issue
    as constใ‚’ๅ‰Š้™คใ—ใ€ActiveMemberๅž‹ใธใฎใ‚ขใ‚ตใƒผใ‚ทใƒงใƒณใ‚’ไฝฟ็”จใ—ใฆไบ’ๆ›ๆ€งใ‚’ไฟๆŒใ—ใพใ™ใ€‚ ___ **as
    constใ‚’ไฝฟ็”จใ™ใ‚‹ใจใ€ใ‚ชใƒ–ใ‚ธใ‚งใ‚ฏใƒˆใฎใƒ—ใƒญใƒ‘ใƒ†ใ‚ฃใŒใƒชใƒ†ใƒฉใƒซๅž‹ใจใ—ใฆๆ‰ฑใ‚ใ‚Œใ€ๅค‰ๆ›ดไธๅฏ่ƒฝใซใชใ‚Šใพใ™ใŒใ€ActiveMemberๅž‹ใจใฎไบ’ๆ›ๆ€งใŒๅคฑใ‚ใ‚Œใ‚‹ๅฏ่ƒฝๆ€งใŒใ‚ใ‚Šใพใ™ใ€‚ๅž‹ใ‚ขใ‚ตใƒผใ‚ทใƒงใƒณใ‚’ไฝฟ็”จใ—ใฆใ€ๅž‹ใฎไบ’ๆ›ๆ€งใ‚’ไฟ่จผใ™ใ‚‹ใ“ใจใ‚’ใŠๅ‹งใ‚ใ—ใพใ™ใ€‚** [mocks/fixtures/activeMember.ts [12]](https://github.com/r-sugi/nextjs-tdd-template/pull/185/files#diff-ff95b84573e7dbb4f03791943c0b3bbd0101b0274da096d39e0744935093a260R12-R12) ```diff -} as const satisfies ActiveMember; +} as ActiveMember; ```
    Suggestion importance[1-10]: 8 Why: The suggestion correctly identifies a potential issue with using `as const`, which could lead to incompatibility with the `ActiveMember` type. By using `as ActiveMember`, it ensures type compatibility while maintaining immutability.
    8