Skip to content

Commit f477716

Browse files
committed
fix: relax isTemplateLiteral check for tslib compat
microsoft/tslib#277
1 parent b1675cc commit f477716

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

package-lock.json

Lines changed: 6 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
"jsr": "^0.13.2",
8888
"minimist": "^1.2.8",
8989
"ts-node": "^10.9.2",
90+
"tslib": "^2.8.1",
9091
"typedoc": "^0.27.2",
9192
"typescript": "^5.7.2"
9293
}

src/main/ts/util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const isStringLiteral = (
3838
): pieces is TemplateStringsArray =>
3939
pieces?.length > 0 &&
4040
pieces.raw?.length === pieces.length &&
41-
Object.isFrozen(pieces) &&
41+
// Object.isFrozen(pieces) &&
4242
rest.length + 1 === pieces.length
4343

4444
export const assign = <T, E>(target: T, ...extras: E[]): T =>

src/test/ts/util.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as assert from 'node:assert'
22
import {describe, it, test} from 'node:test'
33
import { assign, isStringLiteral } from '../../main/ts/util.js'
4+
import tslib from 'tslib'
45

56
describe('util', () => {
67
it('assign()', () => {
@@ -13,6 +14,7 @@ describe('util', () => {
1314
assert.ok(isStringLiteral``)
1415
assert.ok(isStringLiteral`foo`)
1516
assert.ok(isStringLiteral`foo ${bar}`)
17+
assert.ok(isStringLiteral(tslib.__makeTemplateObject(["git pull --tags --force ", " ", ""], ["git pull --tags --force ", " ", ""]), 'foo', 'bar'))
1618

1719
assert.ok(!isStringLiteral(''))
1820
assert.ok(!isStringLiteral('foo'))

0 commit comments

Comments
 (0)