Pretty much the question on the title. There is this old thread from 3 years back - I wasn’t sure whether it would be a good idea to bump that seeing as official TS support has only just come to the fore.
The Meteor TS boilerplate project defines Mongo Collections using just a TS interface - which makes sense in terms of simplicity. However, SimpleSchema provides more than just static typing (most notably the runtime data manipulations/protections), so I would think that using them both would be better, albeit more effort?
Does anyone have any thoughts one way or the other?
Not much experience with TS, yet, as we are still in the consideration phase.
For us, we are using simpleSchema to protect our app from wrong inputs coming from the client. This is something that TS will not be able to provide. We also use simpleSchema in a number of custom validations depending on the inputs
I see simpleSchema as a runtime tool (as you’ve also mentioned).
I’m just in the process of combining the two. Though I think it will require some type assertions or similar as I don’t think Simple Schema has the typings necessary. E.g. Getting this TS warning:
Property 'schema' does not exist on type 'Collection<MyDocumentType>'
Anyone know why a …d.ts file may NOT be getting read/compiles (not sure of the right word here).
I tried moving out the above code to its own meteorDefs.d.ts file in the project root (to keep it separate from my custom types) and it does not seem to register: