Giter Club home page Giter Club logo

Comments (4)

Zazama avatar Zazama commented on August 23, 2024 1

It's true that this is technically a bug, but the types are meant as optional and not undefined (which is the same in standard TS, though). If possible, I'd consider removing undefined values from the passed Tags object (check out e.g. https://stackoverflow.com/questions/25421233/javascript-removing-undefined-fields-from-an-object) until this is fixed.

Notes to myself:
From quick look https://github.com/Zazama/node-id3/blob/master/src/TagsHelpers.ts#L20 Object.entries will return [..., ['synchronisedLyrics', undefined]]

In the new code base it might be possible to use https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-4.html#exact-optional-property-types---exactoptionalpropertytypes but that doesn't help here because v0.2 is not compiled with TS.

Just filter instead?

from node-id3.

pbricout avatar pbricout commented on August 23, 2024

In the new code base it might be possible to use https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-4.html#exact-optional-property-types---exactoptionalpropertytypes but that doesn't help here because v0.2 is not compiled with TS.

Interesting I did not know about this one.

Just filter instead?

I will think to a solution.

from node-id3.

Sandakan avatar Sandakan commented on August 23, 2024

You could take the default parameter for syncronisedLyrics as an empty array.

from node-id3.

pbricout avatar pbricout commented on August 23, 2024

The tsconfig of the project has strict mode enabled, but this mode doesn't turn on exactOptionalPropertyTypes by default, so thus indeed, optional properties are currently defined with the extra | undefined. The project also builds fine with the flag set though.
However, since we do not specify clearly in the documentation which mode is supported and that the strict default tsconfig is with undefined, I agree we should support this.
Looking at the code, the cleanest way to support it is to filter out tag properties that are undefined. The location pointed by @Zazama is definitely one place to be changed, I need to check the code again to see if there are other places where this needs to be changed.
I'll create a PR with a fix this weekend I think.

from node-id3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.