github evanw/esbuild v0.11.21

latest releases: v0.24.0, v0.23.1, v0.23.0...
3 years ago
  • TypeScript override for parameter properties (#1262)

    You can now use the override keyword instead of or in addition to the public, private, protected, and readonly keywords for declaring a TypeScript parameter property:

    class Derived extends Base {
      constructor(override field: any) {
      }
    }

    This feature was recently added to the TypeScript compiler and will presumably be in an upcoming version of the TypeScript language. Support for this feature in esbuild was contributed by @g-plane.

  • Fix duplicate export errors due to TypeScript import-equals statements (#1283)

    TypeScript has a special import-equals statement that is not part of JavaScript. It looks like this:

    import a = foo.a
    import b = a.b
    import c = b.c
    
    import x = foo.x
    import y = x.y
    import z = y.z
    
    export let bar = c

    Each import can be a type or a value and type-only imports need to be eliminated when converting this code to JavaScript, since types do not exist at run-time. The TypeScript compiler generates the following JavaScript code for this example:

    var a = foo.a;
    var b = a.b;
    var c = b.c;
    export let bar = c;

    The x, y, and z import statements are eliminated in esbuild by iterating over imports and exports multiple times and continuing to remove unused TypeScript import-equals statements until none are left. The first pass removes z and marks y as unused, the second pass removes y and marks x as unused, and the third pass removes x.

    However, this had the side effect of making esbuild incorrectly think that a single export is exported twice (because it's processed more than once). This release fixes that bug by only iterating multiple times over imports, not exports. There should no longer be duplicate export errors for this case.

  • Add support for type-only TypeScript import-equals statements (#1285)

    This adds support for the following new TypeScript syntax that was added in version 4.2:

    import type React = require('react')

    Unlike import React = require('react'), this statement is a type declaration instead of a value declaration and should be omitted from the generated code. See microsoft/TypeScript#41573 for details. This feature was contributed by @g-plane.

Don't miss a new esbuild release

NewReleases is sending notifications on new releases.