Comments (4)
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.
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.
You could take the default parameter for syncronisedLyrics as an empty array.
from node-id3.
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)
- [feature] Add support for React Native HOT 5
- length/TLEN HOT 2
- Not working with typescript HOT 2
- (Existing) tag for 'year' not returned HOT 5
- ImageBuffer returns undefined after editing other tags HOT 2
- Explain in docs that `write` doesn't create new file =) HOT 4
- "releaseTime" tag not read from AIFF file HOT 6
- Duration not supported HOT 1
- Add constants for obscure tag values HOT 7
- update function does not take v4 tags into account
- Changes and fixes for new API release
- Updating tags in AIFF files makes tags/audio unreadable by other applications HOT 5
- Incorrect timestamps on Syncronized lyrics HOT 16
- [BuG] MP3 File is corrupted HOT 8
- Not reading id3v1 HOT 1
- Support for audio formats other than mp3 HOT 4
- Support large files HOT 2
- Issues with metadata being read by certain players HOT 2
- Basic adding tags not working HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-id3.