Skip to content

2.19.0 (2023-12-30)

Compare
Choose a tag to compare
@strager strager released this 30 Dec 07:24
· 171 commits to master since this release

Downloads

Added

  • Unicode 15.1 is now supported, including new CJK code points in identifiers.
  • Missing break; (or return; or throw ...; or // fallthrough) after a
    clause in switch statement now reports E0427 ("missing 'break;' or '//
    fallthrough' comment between statement and 'case'"). (Implemented by Yash
    Masani
    .)
  • Detection of multiple export default statements (E0715) now also applies
    to export {... as default}; statements.
  • JSX elements and fragments are now allowed in JSX attributes without
    surrounding them in { and } (e.g.
    <List header=<ListHeader />>{items}</List>).
  • TypeScript support (still experimental):
    • export as namespace statements are now parsed.
    • Const generic parameters (<const T>) are now parsed.
    • Assertion signatures (function f(param): asserts param) are now parsed.
    • If a type predicate appears outside a return type, quick-lint-js now reports
      E0426 ("type predicates are only allowed as function return types").
    • export default now supports separately-declared TypeScript interfaces and
      types.
    • cond ? (param): ReturnType => body : f is now correctly parsed as a
      conditional expression with a function in the truthy branch.
      (cond ? (t) : param => body continues to be parsed as a conditional
      expression with a function in the falsy branch.)
    • Using << in an interface's extends clause, in a class's implements
      clause, or in a typeof type now reports E0429 instead of misleading
      diagnostics. (Implemented by strager and Ariel Don.)
    • Properties in object literal types can now be named with number and string
      literals.
    • Repeating in or out generic parameter modifiers now reports E0432
      ("'in' or 'out' variance specifier cannot be listed twice").
    • Writing a newline after an in, out, or const generic parameter
      modifier now reports E0440 ("newline is not allowed after 'in' modifier
      in generic parameter"). (Implemented by Ariel Don.)
    • Negative number literals are now parsed in types.
    • Parameter decorators are now parsed.
    • Overload signatures are now allowed on exported functions.
    • Assigning to a class now reports E0003 ("cannot assign to class").
    • Definite assignment assertions (! after a variable name in let or var)
      is now supported.
    • override is now supported in classes.
    • Abstract constructor types (such as abstract new () => C) are now
      supported.
    • export class { m(); } in a .d.ts file no longer falsely reports E0172
      ("missing body for function").
    • import() type assertions are now allowed in TypeScript types.
    • U+0085 (Next Line) is now interpreted as whitespace.

Fixed

  • Class decorators may now reference the class by name.
  • Decorators are now parsed correctly when using a semicolon-free coding style.
  • Properties named 'private', 'declare', or similar names are now parsed
    correctly when using a semicolon-free coding style.
  • A newline between an arrow function and a parenthesized expression (e.g.
    let f = () => {} /*newline*/ (console.log('x')); no longer falsely reports
    E0211 ("missing parentheses around self-invoked function").
  • for await (async of []); no longer falsely reports E0082 ("assigning to
    'async' in a for-of loop requires parentheses"). (for (async of []); still
    reports the diagnostic.)
  • A return statement inside a nested switch no longer falsely repots
    E0427 ("missing 'break;' or '// fallthrough' comment between " "statement
    and 'case'").
  • TypeScript support (still experimental):
    • Types named await, implements, interface, let, package, private,
      protected, public, static, and yield are now recognized in type
      signatures.
    • export default with a class and an interface (triggering declaration
      merging) no longer fasely reports E0715 ("cannot use multiple export default statements in one module").
    • class C<T extends U, U> {} no longer falsely reports E0058 ("variable
      used before declaration").
    • case await x: no longer treats : as if it was a type annotation colon in
      an arrow function parameter list.
    • Fixed a crash if certain diagnostics are reported after a TypeScript
      interface. (Implemented by Rui Serra.)
    • import("modulename").Class<<T>(params) => ReturnType> in a type is now
      parsed correctly.
    • import("modulename") in a type is now allowed and no longer falsely
      reports a diagnostic.
    • import type * from 'othermodule'; no longer crashes quick-lint-js with an
      assertion failure.
    • Generic call signatures are now parsed correctly when using a semicolon-free
      coding style.
    • Interface index signatures and computed property names in interfaces are now
      parsed correctly when using a semicolon-free coding style.
    • Properties named 'extends' or 'is' are now parsed correctly when using a
      semicolon-free coding style.
    • Types named 'asserts' are parsed correctly when using a semicolon-free
      coding style.
    • declare const x = 42; no longer falsely reports E0351 or E0385.
    • type T = T.thing; no longer falsely reports E0384 ("cannot use type
      directly in its own definition").
    • Interface methods and index signatures can now end in , (in addition to
      ;).
    • Parsing of ; and , between and after properties in object types is much
      less buggy.
    • quick-lint-js no longer incorrectly reports E0384 ("cannot use type
      directly in its own definition") when using extends ? :.
    • Making a type alias and a function with the same name no longer falsely
      reports E0034 ("redeclaration of variable").
    • Importing a type then declaring a function or variable with the same name no
      longer falsely reports E0034 ("redeclaration of variable").
    • Importing a function or variable then declaring a type with the same name no
      longer falsely reports E0034 ("redeclaration of variable").
    • T extends () => RT ? A : B no longer falsely reports E0348
      ("unexpected '?' in type; use '| void' to make an optional type").
    • <T extends /> is now correctly parsed as a JSX element.
    • interface I { get: any; } (field named get with a type annotation) no
      longer reports E0054 ("unexpected token"). (Implemented by Rui
      Serra
      .)
    • In type assertions, certain types such as in <string[]>expr and
      < <T>() => RT>expr, are no longer incorrectly interpreted as JSX.
    • Assigning to an enum or namespace no longer crashes quick-lint-js with an
      assertion failure.
    • Subnamespaces can now be named contextual keywords such as string.
    • Import aliases can now be named contextual keywords such as implements.
    • Optional function parameters can now be named contextual keywords such as
      readonly.
    • Import aliases can now be declared with import type.
    • Namespace aliases can now reference variables named contextual keywords such as
      yield inside namespaces.
    • Type annotations can now reference types inside namespaces named contextual
      keywords such as string.
    • import A = ns; class A {} no longer crashes or falsely reports that A
      was redeclared.
    • import {type A from 'mod'}; let A; no longer crashes or falsely reports
      that A was redeclared.
    • extends checks with multiple infers no longer crash or falsely report
      that the inferred variable was redeclared.
    • class implements I {} is now parsed as a class with no name rather than a
      class with the name implements.
    • class C extends Base<T> implements I {} now correctly parses Base<T> as
      a type with generic arguments rather than logical comparisons.
    • Variables declared inside a declare global block are now correctly
      declared as global variables instead of module variables. This means that
      variables inside a declare global block can be shadowed by module
      variables without diagnostics.
    • Fixed false negatives for E0196 if a type has the same name as a
      variable.
    • Using a variable in a type or interface (e.g. with typeof) no longer
      falsely reports E0058 ("variable used before declaration").
    • Type predicates in function types no longer falsely report E0315
      ("'param' is not the name of a parameter").
    • Arrow functions with return type annotations such as (42) or (string[])
      are now parsed correctly.
    • f<T>?.() (optional chaining function call with generic function arguments)
      is now parsed correctly.
    • In a .d.ts file, declare module without a body no longer falsely reports
      errors.
    • export default inside a declare module no longer falsely reports
      E0715 ("cannot use multiple export default statements in one module").
    • typeof in types now supports variables named boolean, string, and some
      other names.
    • An optional parameter with ? followed by an optional parameter with = no
      longer falsely reports E0379 ("optional parameter cannot be followed by
      a required parameter").
    • extends in some cases is no longer incorrectly interpreted as an infer
      constraint, such as in
      MyType extends (infer T extends U ? T1 : F1) ? T2 : F2;.
    • Nested extends, such as in A extends () => B extends C ? D : E ? F : G,
      no longer falsely reports E0348 ("unexpected '?' in type; use '| void'
      to make an optional type").
    • class T<T> {} no longer falsely reports E0034 ("redeclaration of
      variable").
    • await <T>() => {} no longer does confusing things.