* Parse JSDoc ...T and T= only at top-level JSDoc ...T and T= should only be legal at the top level of a type, and only in JSDoc, since at least T= is ambiguous elsewhere. This PR changes parsing to make that happen. The resulting parse tree is now simpler, allowing me to get rid of some code I had to add in the checker. * Extract JSDoc type parsing into its own function * PR comments:return from parseJSDocType
25 lines
606 B
TypeScript
25 lines
606 B
TypeScript
// @strict: true
|
|
|
|
// grammar error from checker
|
|
var ara: Array.<number> = [1,2,3];
|
|
|
|
function f(x: ?number, y: Array.<number>) {
|
|
return x ? x + y[1] : y[0];
|
|
}
|
|
function hof(ctor: function(new: number, string)) {
|
|
return new ctor('hi');
|
|
}
|
|
function hof2(f: function(this: number, string): string) {
|
|
return f(12, 'hullo');
|
|
}
|
|
var whatevs: * = 1001;
|
|
var ques: ? = 'what';
|
|
var g: function(number, number): number = (n,m) => n + m;
|
|
var most: !string = 'definite';
|
|
var postfixdef: number! = 101;
|
|
var postfixopt: number? = undefined;
|
|
|
|
var nns: Array<?number>;
|
|
var dns: Array<!number>;
|
|
var anys: Array<*>;
|
|
|