Hi all,
question about using Typescript in Meteor 1.10. I am quite familiar with ES2015+ and also Meteor, but not with Typescript.
In my main.ts I have the following:
import { Meteor } from 'meteor/meteor';
import { Accounts } from 'meteor/accounts-base'
interface User {
username: string;
password: string
}
Meteor.startup(() => {
if(Meteor.users.find().count() === 0) {
try {
const newUser: User = {username: false, password: "admin123"};
const result: string = Accounts.createUser(newUser);
console.log(result);
} catch (e) {
console.log(e);
}
}
});
My expectation is that Typescript should fail this at compile time, because I am defining username in the newUser object with a boolean instead of the string defined in the User interface. But the only error I get is from the check during Accounts.createUser call. Can someone explain why a compile-time error is not shown?