Skip to content

Commit 49df0e7

Browse files
chore(deps): upgrade typescript to 5.1.6 (#4718)
This release includes various refinements and improvements. One thing if fixes is an issue where previously an exported class declaration that included a static property would be not have the export keyword put directly on the class declaration, but instead the symbol would be exported. So with the following typescript: ```ts export class MyClass { static foobar: string = "baz"; } ``` the compiler would emit code like this: ```js class MyClass { static foobar = "baz"; } export { MyClass } ``` instead of ```js export class MyClass { static foobar = "baz; } ``` The former output causes an issue with Rollup, so that issue being fixed is part of the impetus for this upgrade. Try this out [here on the TS playground](https://www.typescriptlang.org/play?useDefineForClassFields=true&target=9&ts=5.1.6&ssl=1&ssc=1&pln=3&pc=1#code/KYDwDg9gTgLgBAYwDYEMDOa4GFUbgbwFgAoOMuNGFGASwTgDNoBbAQQwgRuuABM4AvHBhQArsADcJAL5A) to confirm (toggle between version 5.1 and 5.2 and look at the change in output). See <https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-1.html> for a full list of changes and improvements. Co-authored-by: Ryan Waskiewicz <ryanwaskiewicz@gmail.com>
1 parent 4fd1b28 commit 49df0e7

14 files changed

+33
-320
lines changed

package-lock.json

+8-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
"semver": "^7.3.7",
123123
"sizzle": "^2.3.6",
124124
"terser": "5.19.2",
125-
"typescript": "~5.0.4",
125+
"typescript": "~5.1.6",
126126
"webpack": "^5.75.0",
127127
"ws": "8.13.0"
128128
},

renovate.json5

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
{
6464
// TODO(STENCIL-710): Increment this value as a part of updating TypeScript
6565
matchPackageNames: ['typescript'],
66-
allowedVersions: '<5.0.0',
66+
allowedVersions: '<5.1.6',
6767
},
6868
{
6969
// disable Jest updates until the new testing architecture is in place

src/compiler/transformers/component-lazy/lazy-component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const updateLazyComponentClass = (
1717
cmp: d.ComponentCompilerMeta,
1818
) => {
1919
const members = updateLazyComponentMembers(transformOpts, styleStatements, classNode, moduleFile, cmp);
20-
return updateComponentClass(transformOpts, classNode, classNode.heritageClauses, members, moduleFile);
20+
return updateComponentClass(transformOpts, classNode, classNode.heritageClauses, members);
2121
};
2222

2323
const updateLazyComponentMembers = (

src/compiler/transformers/component-native/native-component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const updateNativeComponentClass = (
2121
): ts.ClassDeclaration | ts.VariableStatement => {
2222
const heritageClauses = updateNativeHostComponentHeritageClauses(classNode, moduleFile);
2323
const members = updateNativeHostComponentMembers(transformOpts, classNode, moduleFile, cmp);
24-
return updateComponentClass(transformOpts, classNode, heritageClauses, members, moduleFile);
24+
return updateComponentClass(transformOpts, classNode, heritageClauses, members);
2525
};
2626

2727
/**

src/compiler/transformers/decorators-to-static/convert-decorators.ts

+1-15
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,8 @@ import { augmentDiagnosticWithNode, buildError } from '@utils';
22
import ts from 'typescript';
33

44
import type * as d from '../../../declarations';
5-
import {
6-
convertValueToLiteral,
7-
createStaticGetter,
8-
retrieveTsDecorators,
9-
retrieveTsModifiers,
10-
} from '../transform-utils';
5+
import { retrieveTsDecorators, retrieveTsModifiers } from '../transform-utils';
116
import { componentDecoratorToStatic } from './component-decorator';
12-
import { hasStaticInitializerInClass } from './convert-static-members';
137
import { isDecoratorNamed } from './decorator-utils';
148
import {
159
CLASS_DECORATORS_TO_REMOVE,
@@ -88,14 +82,6 @@ const visitClassDeclaration = (
8882
listenDecoratorsToStatic(diagnostics, decoratedMembers, filteredMethodsAndFields);
8983
}
9084

91-
// Handle static members that are initialized
92-
const hasStaticMembersWithInit = classMembers.some(hasStaticInitializerInClass);
93-
if (hasStaticMembersWithInit) {
94-
filteredMethodsAndFields.push(
95-
createStaticGetter('stencilHasStaticMembersWithInit', convertValueToLiteral(hasStaticMembersWithInit)),
96-
);
97-
}
98-
9985
// We call the `handleClassFields` method which handles transforming any
10086
// class fields, removing them from the class and adding statements to the
10187
// class' constructor which instantiate them there instead.

src/compiler/transformers/decorators-to-static/convert-static-members.ts

-42
This file was deleted.

src/compiler/transformers/remove-static-meta-properties.ts

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ const REMOVE_STATIC_GETTERS = new Set([
3838
'methods',
3939
'states',
4040
'originalStyleUrls',
41-
'stencilHasStaticMembersWithInit',
4241
'styleMode',
4342
'style',
4443
'styles',

src/compiler/transformers/static-to-meta/component.ts

-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ export const parseStaticComponentMeta = (
6161
componentClassName: cmpNode.name ? cmpNode.name.text : '',
6262
elementRef: parseStaticElementRef(staticMembers),
6363
encapsulation,
64-
hasStaticInitializedMember: getStaticValue(staticMembers, 'stencilHasStaticMembersWithInit') ?? false,
6564
shadowDelegatesFocus: parseStaticShadowDelegatesFocus(encapsulation, staticMembers),
6665
properties: parseStaticProps(staticMembers),
6766
virtualProperties: parseVirtualProps(docs),

src/compiler/transformers/test/convert-static-members.spec.ts

-217
This file was deleted.

0 commit comments

Comments
 (0)