frenic / csstype

Strict TypeScript and Flow types for style based on MDN data
MIT License
1.7k stars 69 forks source link

Compatibility with Typescript 4.1 #118

Closed phiresky closed 3 years ago

phiresky commented 3 years ago

TS 4.1

adds string literal type concatenation which should make this module work a lot better.

But also, it seems to make (string & {} ) be never, so all the current types break.

For example, color: "#00d54f" is an error:

Type '"#00d54f"' is not assignable to type '"inherit" | "-moz-initial" ...
frenic commented 3 years ago

I've added tests against Typescript 4.1-beta a while ago and didn't see any problems. I just upgraded to 4.1.2 and added a color property but there's no error on that 🤔

frenic commented 3 years ago

String template literals will be used somehow. I'll ensure you that. But I see that as a major change so it will be on hold for a while until 4.1 is more established. It would cause chaos otherwise.

But I need more information regarding your other issue. Can you create a repository where you can reproduce the error?

phiresky commented 3 years ago

sorry, turns out it wasn't the fault of this library. The problem was I have this in my code base somewhere:

declare global {
    interface Number {
        "~type": "number";
    }
    interface String {
        "~type": "string";
    }
}

This worked fine in the older versions, but in TS 4.1 apparently this means that all string & .... merges break.