testShorthandPropertiesHashLikeExplicitOnes

tcmts.core.test.hash.testShorthandPropertiesHashLikeExplicitOnes · #fkjhatqp · term

Shorthand and explicit property forms hash the same.

import { hashes } from "#codebase/tcmts/core/test/hash";
import assert from "node:assert/strict";

export const testShorthandPropertiesHashLikeExplicitOnes = () => {
  assert.equal(hashes(`const f = (o: { a: number }) => { const { a } = o; return { a } }`).f, hashes(`const f = (o: { a: number }) => { const { a: a } = o; return { a: a } }`).f);
  assert.equal(hashes(`const f = (o: { a?: number }) => { const { a = 1 } = o; return a }`).f, hashes(`const f = (o: { a?: number }) => { const { a: a = 1 } = o; return a }`).f);
  assert.equal(hashes(`const x = 1; const f = () => ({ x })`).f, hashes(`const x = 1; const f = () => ({ x: x })`).f);
}

uses