Skip to content

Commit 2fcbdfa

Browse files
committed
Add TODOs for ES2015 improvements
1 parent de6464c commit 2fcbdfa

File tree

8 files changed

+10
-5
lines changed

8 files changed

+10
-5
lines changed

packages/firestore/test/unit/specs/spec_rpc_error.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ export class RpcError extends Error {
3333
this.code = mapRpcCodeFromCode(code);
3434
}
3535

36-
// TODO(mikelehen): Error is a function not a class in ES5 so extending it
36+
// TODO(dlarocque): Improve this since we no longer target ES5.
37+
// Error is a function not a class in ES5 so extending it
3738
// doesn't really work without hackery. Just manually set .message for now.
3839
this.message = message;
3940
}

packages/installations/src/testing/compare-headers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import { AssertionError, expect } from 'chai';
1919

2020
// Trick TS since it's set to target ES5.
21+
// TODO(dlarocque): Improve this since we no longer target ES5.
2122
declare class HeadersWithEntries extends Headers {
2223
entries?(): Iterable<[string, string]>;
2324
}

packages/messaging/rollup.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ const cjsBuilds = [
7878
// builds (contingent on updating the `idb` dependency). When we add
7979
// ESM Node builds, test with Nuxt and other SSR frameworks to see if
8080
// this can then be removed.
81-
// TODO (dlarocque): ask Christina about this
81+
// TODO(dlarocque): ask Christina about this
8282
{
8383
input: 'src/index.sw.ts',
8484
output: { file: pkg['sw-main'], format: 'cjs', sourcemap: true },

packages/messaging/src/testing/compare-headers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import './setup';
2020
import { expect } from 'chai';
2121

2222
// Trick TS since it's set to target ES5.
23+
// TODO(dlarocque): Improve this since we no longer target ES5.
2324
declare class HeadersWithEntries extends Headers {
2425
entries?(): Iterable<[string, string]>;
2526
}

packages/remote-config/rollup.config.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ import pkg from './package.json';
2626
const deps = Object.keys(
2727
Object.assign({}, pkg.peerDependencies, pkg.dependencies)
2828
);
29-
/**
30-
* ES5 Builds
31-
*/
3229

3330
const buildPlugins = [
3431
typescriptPlugin({

packages/util/src/crypt.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ interface Base64 {
104104
// We define it as an object literal instead of a class because a class compiled down to es5 can't
105105
// be treeshaked. https://github.com/rollup/rollup/issues/1691
106106
// Static lookup maps, lazily populated by init_()
107+
// TODO(dlarocque): Define this as a class, since we no longer target ES5.
107108
export const base64: Base64 = {
108109
/**
109110
* Maps bytes to characters.

packages/util/src/errors.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ export class FirebaseError extends Error {
8686

8787
// Fix For ES5
8888
// https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
89+
// TODO(dlarocque): Replace this with `new.target`: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget
90+
// which we can now use since we no longer target ES5.
8991
Object.setPrototypeOf(this, FirebaseError.prototype);
9092

9193
// Maintains proper stack trace for where our error was thrown.

packages/vertexai/src/errors.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ export class VertexAIError extends FirebaseError {
5656

5757
// Allows instanceof VertexAIError in ES5/ES6
5858
// https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
59+
// TODO(dlarocque): Replace this with `new.target`: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget
60+
// which we can now use since we no longer target ES5.
5961
Object.setPrototypeOf(this, VertexAIError.prototype);
6062

6163
// Since Error is an interface, we don't inherit toString and so we define it ourselves.

0 commit comments

Comments
 (0)