Skip to content

Commit

Permalink
Remove noImplicitUseStrict usage in tests
Browse files Browse the repository at this point in the history
The options is deprecated and is going to be removed in TypeScript. tsickle's googmodule transformer already removes "use strict", so this option has no effect.

__awaiter change: The first argument is `thisArg`. It's `this` if there is a lexical this in scope, which changes based on strict mode. Tsickle output is expected to be bundled with Closure Compiler, which assumes strict mode, so `noImplicitUseStrict` should generally be turned off.

PiperOrigin-RevId: 541810412
  • Loading branch information
frigus02 committed Jul 12, 2023
1 parent ff2a726 commit d391580
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
10 changes: 4 additions & 6 deletions test/googmodule_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ describe('convertCommonJsToGoogModule', () => {
goog.module('project.file');
var module = module || { id: 'project/file.ts' };
const tslib_1 = goog.require('tslib');
(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
const starImport = yield goog.requireDynamic('project.relpath');
}))();
`).split(/\n/g));
Expand All @@ -539,9 +539,8 @@ describe('convertCommonJsToGoogModule', () => {
expect(beforeLines).toEqual(outdent(`
goog.module('project.file');
var module = module || { id: 'project/file.ts' };
var _this = this;
var tslib_1 = goog.require('tslib');
(function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
(function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
var starImport;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
Expand Down Expand Up @@ -571,7 +570,7 @@ describe('convertCommonJsToGoogModule', () => {
goog.module('project.file');
var module = module || { id: 'project/file.ts' };
const tslib_1 = goog.require('tslib');
(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
const { Foo } = yield goog.requireDynamic('project.relpath');
}))();
`).split(/\n/g));
Expand All @@ -592,9 +591,8 @@ describe('convertCommonJsToGoogModule', () => {
expect(beforeLines).toEqual(outdent(`
goog.module('project.file');
var module = module || { id: 'project/file.ts' };
var _this = this;
var tslib_1 = goog.require('tslib');
(function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
(function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
var Foo;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
Expand Down
1 change: 0 additions & 1 deletion test/test_support.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ export const baseCompilerOptions: ts.CompilerOptions = {
experimentalDecorators: true,
module: ts.ModuleKind.CommonJS,
strictNullChecks: true,
noImplicitUseStrict: true,
allowJs: false,
importHelpers: true,
noEmitHelpers: true,
Expand Down
6 changes: 3 additions & 3 deletions test_files/async_functions/async_functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const asyncTopLevelArrowFunction = (/**
* @param {string} param
* @return {!Promise<number>}
*/
(param) => tslib_1.__awaiter(this, void 0, void 0, function* () {
(param) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
/** @type {number} */
const s = yield 3;
return s;
Expand Down Expand Up @@ -122,12 +122,12 @@ if (false) {
const asyncArrowFn = (/**
* @return {!Promise<void>}
*/
() => tslib_1.__awaiter(this, void 0, void 0, function* () { }));
() => tslib_1.__awaiter(void 0, void 0, void 0, function* () { }));
/** @type {function(): !Promise<void>} */
exports.exportedAsyncArrowFn = (/**
* @return {!Promise<void>}
*/
() => tslib_1.__awaiter(this, void 0, void 0, function* () { }));
() => tslib_1.__awaiter(void 0, void 0, void 0, function* () { }));
/**
* @return {function(): !Promise<number>}
* @this {*}
Expand Down

0 comments on commit d391580

Please sign in to comment.