Skip to content

Commit c9a9cec

Browse files
chore: update TS to 5.5
1 parent df1406e commit c9a9cec

File tree

5 files changed

+11
-25
lines changed

5 files changed

+11
-25
lines changed

package-lock.json

+4-3
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
@@ -181,7 +181,7 @@
181181
"semver": "^7.3.7",
182182
"terser": "5.31.1",
183183
"tsx": "^4.10.3",
184-
"typescript": "~5.4.0",
184+
"typescript": "~5.5.3",
185185
"webpack": "^5.75.0",
186186
"ws": "8.17.1"
187187
},

scripts/esbuild/utils/typescript-source.ts

+2-19
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ export async function bundleTypeScriptSource(tsPath: string, opts: BuildOptions)
1919
} catch (e) {}
2020

2121
// get the source typescript.js file to modify
22+
console.log('READ', tsPath);
23+
2224
let code = await fs.readFile(tsPath, 'utf8');
2325

2426
// As of 5.0, because typescript is now bundled with esbuild the structure of
@@ -74,25 +76,6 @@ export async function bundleTypeScriptSource(tsPath: string, opts: BuildOptions)
7476
const jestTypesciptFilename = join(opts.scriptsBuildDir, 'typescript-modified-for-jest.js');
7577
await fs.writeFile(jestTypesciptFilename, code);
7678

77-
// Here we transform the TypeScript source from a commonjs to an ES module.
78-
// We do this so that we can add an import from the `@environment` module.
79-
80-
// trim off the last part that sets module.exports and polyfills globalThis since
81-
// we don't want typescript to add itself to module.exports when in a node env
82-
const tsEnding = `if (typeof module !== "undefined" && module.exports) { module.exports = ts; }`;
83-
84-
if (!code.includes(tsEnding)) {
85-
throw new Error(`"${tsEnding}" not found`);
86-
}
87-
const lastEnding = code.lastIndexOf(tsEnding);
88-
code = code.slice(0, lastEnding);
89-
90-
const o: string[] = [];
91-
o.push(`// TypeScript ${opts.typescriptVersion}`);
92-
o.push(code);
93-
o.push(`export default ts;`);
94-
code = o.join('\n');
95-
9679
// TODO(STENCIL-839): investigate minification issue w/ typescript 5.0
9780
// const { minify } = await import('terser');
9881

src/runtime/proxy-component.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ export const proxyComponent = (
114114
prototype.attributeChangedCallback = function (attrName: string, oldValue: string, newValue: string) {
115115
plt.jmp(() => {
116116
const propName = attrNameToPropName.get(attrName);
117+
this
117118

118119
// In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
119120
// in the case where an attribute was set inline.
@@ -154,7 +155,8 @@ export const proxyComponent = (
154155
} else if (
155156
prototype.hasOwnProperty(propName) &&
156157
typeof this[propName] === 'number' &&
157-
this[propName] == newValue
158+
// cast type to number to avoid TS compiler issues
159+
this[propName] == newValue as unknown as number
158160
) {
159161
// if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
160162
// APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in

test/end-to-end/package-lock.json

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

0 commit comments

Comments
 (0)