Skip to content

Commit f513d70

Browse files
committed
Fix types
1 parent c178efa commit f513d70

File tree

4 files changed

+18
-16
lines changed

4 files changed

+18
-16
lines changed

packages/app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
"circular-json": "^0.4.0",
100100
"codemirror": "^5.27.4",
101101
"codesandbox-api": "0.0.23",
102-
"codesandbox-import-utils": "2.1.2",
102+
"codesandbox-import-utils": "^2.1.11",
103103
"color": "^0.11.4",
104104
"compare-versions": "^3.1.0",
105105
"console": "^0.7.2",

packages/app/src/app/overmind/namespaces/editor/internalActions.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import getTemplateDefinition from '@codesandbox/common/lib/templates';
1+
import getTemplateDefinition, {
2+
TemplateType,
3+
} from '@codesandbox/common/lib/templates';
24
import {
35
Module,
46
ModuleTab,
@@ -189,7 +191,7 @@ export const updateCurrentTemplate: AsyncAction = async ({
189191
templateDefinition.isServer ||
190192
state.editor.parsedConfigurations.sandbox.parsed.template
191193
) {
192-
const { parsed } = state.editor.parsedConfigurations!.package!;
194+
const { parsed = {} } = state.editor.parsedConfigurations!.package!;
193195

194196
const modulesByPath = mapValues(state.editor.modulesByPath, module => ({
195197
// No idea why this typing fails!
@@ -201,8 +203,8 @@ export const updateCurrentTemplate: AsyncAction = async ({
201203

202204
// TODO: What is a template really? Two different kinds of templates here, need to fix the types
203205
// Talk to Ives and Bogdan
204-
const newTemplate =
205-
computeTemplate(parsed!, modulesByPath) || ('node' as any);
206+
const newTemplate = (computeTemplate(parsed, modulesByPath) ||
207+
'node') as TemplateType;
206208

207209
if (
208210
newTemplate !== currentTemplate &&

packages/common/src/templates/template.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ export type Dependencies = { [name: string]: string };
3232
export type ParsedConfigurationFiles = {
3333
package?: ParsedConfigurationFile<{
3434
main: string;
35-
dependencies: Dependencies;
36-
devDependencies: Dependencies;
35+
dependencies?: Dependencies;
36+
devDependencies?: Dependencies;
3737
resolutions?: { [source: string]: string };
3838
scripts?: { [script: string]: string };
3939
[otherProperties: string]: any | undefined;

yarn.lock

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7814,17 +7814,17 @@ codemirror@^5.27.4:
78147814
version "5.38.0"
78157815
resolved "https://registry.yarnpkg.com/codemirror/-/codemirror-5.38.0.tgz#26a9551446e51dbdde36aabe60f72469724fd332"
78167816

7817-
codesandbox-import-util-types@^2.1.2:
7818-
version "2.1.2"
7819-
resolved "https://registry.yarnpkg.com/codesandbox-import-util-types/-/codesandbox-import-util-types-2.1.2.tgz#2d0b7e977eadd4c0b5baeeaaae0b79c7e6c6900a"
7820-
integrity sha512-/6kk/qbV9n+2+vH5aVUNlskyNlhhxGBzzUvt7Ne2MGWkSRv42QMFxuZgMd+bjmXBENUZjrJPGXPK7HxxD1Q67w==
7817+
codesandbox-import-util-types@^2.1.9:
7818+
version "2.1.9"
7819+
resolved "https://registry.yarnpkg.com/codesandbox-import-util-types/-/codesandbox-import-util-types-2.1.9.tgz#24ba5ec3d966f51f18b78c48d32e6411da90aa74"
7820+
integrity sha512-Vc4qh+neVfHtS3RG+7wvaErMoEKdNTnLFnyj4Dcbn3NV7v9nlPj/z6MGhHp9S+vAjegWorFzxg9lKB1WGHTt5Q==
78217821

7822-
7823-
version "2.1.2"
7824-
resolved "https://registry.yarnpkg.com/codesandbox-import-utils/-/codesandbox-import-utils-2.1.2.tgz#30613e28e79db681a555df70e5a916a7797f5c5d"
7825-
integrity sha512-cbvNa+dzYw2R3ofUkj51LsT8DX1GIoWVeDaJdSMJgZQSxXptjrf6zsLogcJtY8ihOURjED8CWEbQvpbHTM94EA==
7822+
codesandbox-import-utils@^2.1.11:
7823+
version "2.1.11"
7824+
resolved "https://registry.yarnpkg.com/codesandbox-import-utils/-/codesandbox-import-utils-2.1.11.tgz#171ce53a77b8dcd196fdcfaf0f6bc52b1206444a"
7825+
integrity sha512-vkA0drdzO2ArMUzl8/AhEuzaW6qX3ic1SXPmruVS7bo/3K1P8H+S9CbuUNPo67X54/LzHwMnAZgZMXwN8vrw7Q==
78267826
dependencies:
7827-
codesandbox-import-util-types "^2.1.2"
7827+
codesandbox-import-util-types "^2.1.9"
78287828
istextorbinary "^2.2.1"
78297829
lz-string "^1.4.4"
78307830

0 commit comments

Comments
 (0)