|
|
|
|
|
by spankalee
428 days ago
|
|
This would be even nicer if TypeScript added type inference for tagged template literals, like in this issue [1]. Then you could write: const schema = proto`
syntax = "proto3";
message Person { ... }
`;
type Person = typeof schema['Person'];
And you could get built-in schema validation with a sophisticated enough type definition for `proto`, nice syntax highlighting in many tools with a nested grammar.We would love to see this feature in TypeScript to be able to have type-safe template in lit-html without an external tool. The issue hasn't seen much activity lately, but it would be good to highlight this library as another use case. [1]: https://github.com/microsoft/TypeScript/issues/33304 |
|