Declaring a larger scope variable type without assigning a value to satisfy JSLint

Can I declare a variable and tell Lint what type it should be, but without giving it a value? I'm having this problem while writing Mocha/Should tests.

If have something like the following:

describe("Test Custom Var", function() {
     var testType = {};

    it("should be successful", function() {
          testType = new TestType(invalid_value);
          result = someFunction(testType);
     });

     it("should be unsuccessful", function() {
         testType = new TestType(valid_value);
          result = someFunction(testType);
     })
})


I get a warning that someFunction is expecting type TestType, and that argument type {} is not assignable to TestType.

Any ideas on how to fix this?

Please sign in to leave a comment.