Skip to content

Commit 4685950

Browse files
committed
Update api to avoid casts in tests
1 parent b22c141 commit 4685950

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/vs/editor/contrib/snippet/snippetParser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ export class FormatString extends Marker {
373373
super();
374374
}
375375

376-
resolve(value: string): string {
376+
resolve(value?: string): string {
377377
if (this.shorthandName === 'upcase') {
378378
return !value ? '' : value.toLocaleUpperCase();
379379
} else if (this.shorthandName === 'downcase') {

src/vs/editor/contrib/snippet/test/snippetParser.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -657,17 +657,17 @@ suite('SnippetParser', () => {
657657
assert.equal(new FormatString(1, 'notKnown').resolve('input'), 'input');
658658

659659
// if
660-
assert.equal(new FormatString(1, undefined, 'foo', undefined).resolve((undefined as any as string)), '');
660+
assert.equal(new FormatString(1, undefined, 'foo', undefined).resolve(undefined), '');
661661
assert.equal(new FormatString(1, undefined, 'foo', undefined).resolve(''), '');
662662
assert.equal(new FormatString(1, undefined, 'foo', undefined).resolve('bar'), 'foo');
663663

664664
// else
665-
assert.equal(new FormatString(1, undefined, undefined, 'foo').resolve((undefined as any as string)), 'foo');
665+
assert.equal(new FormatString(1, undefined, undefined, 'foo').resolve(undefined), 'foo');
666666
assert.equal(new FormatString(1, undefined, undefined, 'foo').resolve(''), 'foo');
667667
assert.equal(new FormatString(1, undefined, undefined, 'foo').resolve('bar'), 'bar');
668668

669669
// if-else
670-
assert.equal(new FormatString(1, undefined, 'bar', 'foo').resolve((undefined as any as string)), 'foo');
670+
assert.equal(new FormatString(1, undefined, 'bar', 'foo').resolve(undefined), 'foo');
671671
assert.equal(new FormatString(1, undefined, 'bar', 'foo').resolve(''), 'foo');
672672
assert.equal(new FormatString(1, undefined, 'bar', 'foo').resolve('baz'), 'bar');
673673
});

0 commit comments

Comments
 (0)