* Parse (and mostly support) template tag constraints A bunch of tests hit the asserts I added though. * Messy version is finished. Need to add a few tests * Refactor to be smaller * Small refactor + Add one test * Another test * Minor cleanup * Fix error reporting on type parameters on ctors * Simplify syntax of `@template` tag This is a breaking change, but in my sample, nobody except webpack used the erroneous syntax. I need to improve the error message, so jsdocTemplateTag3 currently fails to remind me of that. * Better error message for template tag * Fix fourslash baselines * Another fourslash update * Address PR comments * Simplify getEffectiveTypeParameterDeclarations Make checkGrammarConstructorTypeParameters do a little more work
33 lines
759 B
TypeScript
33 lines
759 B
TypeScript
// @allowJs: true
|
|
// @checkJs: true
|
|
// @noEmit: true
|
|
// @Filename: a.js
|
|
/**
|
|
* @template {{ a: number, b: string }} T,U A Comment
|
|
* @template {{ c: boolean }} V uh ... are comments even supported??
|
|
* @template W
|
|
* @template X That last one had no comment
|
|
* @param {T} t
|
|
* @param {U} u
|
|
* @param {V} v
|
|
* @param {W} w
|
|
* @param {X} x
|
|
* @return {W | X}
|
|
*/
|
|
function f(t, u, v, w, x) {
|
|
if(t.a + t.b.length > u.a - u.b.length && v.c) {
|
|
return w;
|
|
}
|
|
return x;
|
|
}
|
|
|
|
f({ a: 12, b: 'hi', c: null }, undefined, { c: false, d: 12, b: undefined }, 101, 'nope');
|
|
f({ a: 12 }, undefined, undefined, 101, 'nope');
|
|
|
|
/**
|
|
* @template {NoLongerAllowed}
|
|
* @template T preceding line's syntax is no longer allowed
|
|
* @param {T} x
|
|
*/
|
|
function g(x) { }
|
|
|