swagger-typescript-api icon indicating copy to clipboard operation
swagger-typescript-api copied to clipboard

anyOf produces redundant type

Open hedgepigdaniel opened this issue 2 years ago • 1 comments

I'm confused as to the purpose of this line of code: https://github.com/acacode/swagger-typescript-api/blob/5817a95706be4299b4afa76801e940bd62020742/src/schema.js#L210

It produces a type like:

type Thing = A | B | C | (A & B & C);

But this is the same as

type Thing = A | B | C;

Anything that is A & B & C must also be one of A, B, or C.

It seems like this just makes the type harder to read?

hedgepigdaniel avatar Feb 15 '22 07:02 hedgepigdaniel

I think this is solved by: https://github.com/acacode/swagger-typescript-api/commit/43baaa254ee6fd6cf71ae38489b2dfa76cd831b4

triptec avatar Oct 26 '23 06:10 triptec