Commit 1ef2f007 authored by Kenichi Kamiya's avatar Kenichi Kamiya Committed by Masum Reza
Browse files
parent 6262669c
Loading
Loading
Loading
Loading
+28 −3
Original line number Diff line number Diff line
@@ -2,26 +2,51 @@
  lib,
  buildNpmPackage,
  fetchFromGitHub,
  replaceVars,
  versionCheckHook,
  nix-update-script,
}:

buildNpmPackage (finalAttrs: {
  pname = "typescript";
  version = "5.8.2";
  version = "5.8.3";

  src = fetchFromGitHub {
    owner = "microsoft";
    repo = "TypeScript";
    tag = "v${finalAttrs.version}";
    hash = "sha256-fOA5IblxUd+C9ST3oI8IUmTTRL3exC63MPqW5hoWN0M=";
    hash = "sha256-/XxjZO/pJLLAvsP7x4TOC+XDbOOR+HHmdpn+8qP77L8=";
  };

  patches = [
    ./disable-dprint-dstBundler.patch

    # Should be removed in next 5.9.X TypeScript update: https://github.com/microsoft/TypeScript/pull/61218#issuecomment-2911264050
    (replaceVars ./revert-bump-to-v5.9.patch {
      inherit (finalAttrs) version;
    })
  ];

  npmDepsHash = "sha256-ytdkxIjAd3UsU90o9IFZa5lGEv39zblBmgTTseVRGKQ=";
  postPatch = ''
    # The test run in the build script is redundant with checkPhase
    substituteInPlace package.json \
     --replace-fail ' && npm run build:tests' ""

    # Should be removed in next 5.9.X TypeScript update
    substituteInPlace src/compiler/corePublic.ts \
      --replace-fail 'versionMajorMinor = "5.9"' 'versionMajorMinor = "5.8"'
    substituteInPlace tests/baselines/reference/api/typescript.d.ts \
      --replace-fail 'versionMajorMinor = "5.9"' 'versionMajorMinor = "5.8"'

    # Imported from https://github.com/microsoft/TypeScript/blob/b504a1eed45e35b5f54694a1e0a09f35d0a5663c/.github/workflows/set-version.yaml#L75
    sed -i -e 's/const version\(: string\)\{0,1\} = .*;/const version = "${finalAttrs.version}" as string;/g' src/compiler/corePublic.ts
  '';

  npmDepsHash = "sha256-BHJGezzZensC/WFsUumJSk6TYAqbS50Inuvw2nV5vUk=";

  postBuild = ''
    npx hereby lkg
  '';

  nativeInstallCheckInputs = [
    versionCheckHook
+52 −0
Original line number Diff line number Diff line
From fb5da5ae2622c4f7bb421f4d9ac6881b07ee220c Mon Sep 17 00:00:00 2001
From: Kenichi Kamiya <kachick1@gmail.com>
Date: Tue, 27 May 2025 16:09:56 +0900
Subject: [PATCH] Revert 1fdf78aee644afd2702d69c148754a7fc1aff910

This was an unintended slipped commit into v5.8.n
Should be removed until actually release 5.9

See https://github.com/microsoft/TypeScript/pull/61218#issuecomment-2911264050 for detail

Intentionally omitted to patch corePublic.ts and the d.ts
Including CRLF causes patching error in nixpkgs
---
 package-lock.json | 4 ++--
 package.json      | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index d4d2c055cc..63a0b372d2 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
 {
     "name": "typescript",
-    "version": "5.9.0",
+    "version": "@version@",
     "lockfileVersion": 2,
     "requires": true,
     "packages": {
         "": {
             "name": "typescript",
-            "version": "5.9.0",
+            "version": "@version@",
             "license": "Apache-2.0",
             "bin": {
                 "tsc": "bin/tsc",
diff --git a/package.json b/package.json
index ef2c80f8b9..0972bb4648 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
     "name": "typescript",
     "author": "Microsoft Corp.",
     "homepage": "https://www.typescriptlang.org/",
-    "version": "5.9.0",
+    "version": "@version@",
     "license": "Apache-2.0",
     "description": "TypeScript is a language for application scale JavaScript development",
     "keywords": [
-- 
2.49.0