GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fraction methods are not typed · Issue #3317 · josdejong/mathjs

fraction methods are not typed #3317

New issue
Copy link
New issue
Copy link
Closed
#3330
Closed
fraction methods are not typed#3317
#3330
Copy link
Labels
bughelp wantedtypescript

Description

@yukulele
yukulele
opened on Nov 16, 2024
Issue body actions

Describe the bug
Fraction type only exposes s, n add d properties

mathjs/types/index.d.ts:4018:

export interface Fraction {
  s: number
  n: number
  d: number
}

so we can't use methods

To Reproduce

math.fraction('1.5').toFraction() // "3/2"
> tsc
error TS2339: Property 'toFraction' does not exist on type 'Fraction'.

9 math.fraction('1.5').toFraction()
                       ~~~~~~~~~~

Activity

  1. josdejong commented on Nov 20, 2024

    @josdejong
    josdejong
    on Nov 20, 2024
    Owner
    More actions

    Thanks for reporting, we should improve the TypeScript definitions. Ideally, we can import and use type definitions from Fraction.js.

    Who can help fix the TypeScript definitions of fractions?

  2. josdejong
    added
    bug
    help wanted
    typescript
    on Nov 20, 2024
  3. yukulele commented on Nov 20, 2024

    @yukulele
    yukulele
    on Nov 20, 2024
    ContributorAuthor
    More actions

    I think you might need to update the fraction.js version first, which is out outdated.

  4. josdejong commented on Nov 20, 2024

    @josdejong
    josdejong
    on Nov 20, 2024
    Owner
    More actions

    Yes, that is addressed via #3283, it is a breaking change planned for v14.

    Reacted by Clément P
  5. josdejong
    closed this as completedin #3330on Dec 11, 2024
  6. josdejong commented on Dec 11, 2024

    @josdejong
    josdejong
    on Dec 11, 2024
    Owner
    More actions

    Fixed now in v14.0.1.

    Reacted by Clément P
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bughelp wantedtypescript

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402792 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.