From dde8fce9567f709ba20d37ea436e240ccef70995 Mon Sep 17 00:00:00 2001 From: Robert Jackson Date: Tue, 5 May 2020 19:14:34 -0400 Subject: [PATCH 1/2] Disable allowJs in tsconfig.json. This demonstrates a failure that only cropped up when publishing (because `ember ts:precompile` uses `--allowJs false`). --- tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index 425b264e7..2b52abc82 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "target": "es2017", - "allowJs": true, + "allowJs": false, "moduleResolution": "node", "allowSyntheticDefaultImports": true, "noImplicitAny": true, From 8c61887a4819061f06ae999844d0cc0d7a09107d Mon Sep 17 00:00:00 2001 From: Robert Jackson Date: Tue, 5 May 2020 19:19:27 -0400 Subject: [PATCH 2/2] Migrate from `requirejs.entries` to `has`. This fixes the tsc compilation issues. --- .../@ember/test-helpers/-internal/build-registry.ts | 6 ++---- types/require.d.ts | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/addon-test-support/@ember/test-helpers/-internal/build-registry.ts b/addon-test-support/@ember/test-helpers/-internal/build-registry.ts index 7bb88ecd8..72b7841e2 100644 --- a/addon-test-support/@ember/test-helpers/-internal/build-registry.ts +++ b/addon-test-support/@ember/test-helpers/-internal/build-registry.ts @@ -1,11 +1,9 @@ -/* globals global, requirejs */ - import Resolver from '@ember/application/resolver'; import ApplicationInstance from '@ember/application/instance'; import Application from '@ember/application'; import EmberObject from '@ember/object'; -import require from 'require'; +import require, { has } from 'require'; import Ember from 'ember'; /** @@ -91,7 +89,7 @@ export default function (resolver: Resolver) { exposeRegistryMethodsWithoutDeprecations(container); - if ((requirejs as any).entries['ember-data/setup-container']) { + if (has('ember-data/setup-container')) { // ember-data is a proper ember-cli addon since 2.3; if no 'import // 'ember-data'' is present somewhere in the tests, there is also no `DS` // available on the globalContext and hence ember-data wouldn't be setup diff --git a/types/require.d.ts b/types/require.d.ts index 0295f4234..c060d7c3e 100644 --- a/types/require.d.ts +++ b/types/require.d.ts @@ -1 +1,2 @@ export default function (moduleName: string): T; +export function has(moduleName: string): T;