From 4f6b0a9eac416cb81e4333740aa2bad26f8a43d9 Mon Sep 17 00:00:00 2001 From: Hercules CI Effects Date: Sat, 27 Jan 2024 14:29:16 +0000 Subject: [PATCH] Update gh-pages Store path: /nix/store/myiv3b32cmbq17zkvq97z9y52n1w0py5-lambda-buffers-book --- typescript-plutus/.gitignore | 1 + typescript-plutus/api/lbf/MySchema.lbf | 13 ++ typescript-plutus/api/lbf/build.nix | 17 +++ typescript-plutus/build.nix | 27 ++++ typescript-plutus/package-lock.json | 173 ++++++++++++++++++++++++ typescript-plutus/package.json | 32 +++++ typescript-plutus/src/index.mts | 126 +++++++++++++++++ typescript-plutus/src/tsconfig.json | 5 + typescript-plutus/tsconfig-base.json | 109 +++++++++++++++ typescript-prelude/.gitignore | 1 + typescript-prelude/api/lbf/MySchema.lbf | 11 ++ typescript-prelude/api/lbf/build.nix | 17 +++ typescript-prelude/build.nix | 26 ++++ typescript-prelude/package-lock.json | 105 ++++++++++++++ typescript-prelude/package.json | 29 ++++ typescript-prelude/src/index.mts | 61 +++++++++ typescript-prelude/src/tsconfig.json | 5 + typescript-prelude/tsconfig-base.json | 109 +++++++++++++++ 18 files changed, 867 insertions(+) create mode 100644 typescript-plutus/.gitignore create mode 100644 typescript-plutus/api/lbf/MySchema.lbf create mode 100644 typescript-plutus/api/lbf/build.nix create mode 100644 typescript-plutus/build.nix create mode 100644 typescript-plutus/package-lock.json create mode 100644 typescript-plutus/package.json create mode 100644 typescript-plutus/src/index.mts create mode 100644 typescript-plutus/src/tsconfig.json create mode 100644 typescript-plutus/tsconfig-base.json create mode 100644 typescript-prelude/.gitignore create mode 100644 typescript-prelude/api/lbf/MySchema.lbf create mode 100644 typescript-prelude/api/lbf/build.nix create mode 100644 typescript-prelude/build.nix create mode 100644 typescript-prelude/package-lock.json create mode 100644 typescript-prelude/package.json create mode 100644 typescript-prelude/src/index.mts create mode 100644 typescript-prelude/src/tsconfig.json create mode 100644 typescript-prelude/tsconfig-base.json diff --git a/typescript-plutus/.gitignore b/typescript-plutus/.gitignore new file mode 100644 index 00000000..28bd684b --- /dev/null +++ b/typescript-plutus/.gitignore @@ -0,0 +1 @@ +extra-dependencies/ diff --git a/typescript-plutus/api/lbf/MySchema.lbf b/typescript-plutus/api/lbf/MySchema.lbf new file mode 100644 index 00000000..1b791af2 --- /dev/null +++ b/typescript-plutus/api/lbf/MySchema.lbf @@ -0,0 +1,13 @@ +module MySchema + +import Plutus.V1 +import Prelude (Eq, Json) + +sum Branchy a + = Node PlutusData (Extended (Branchy a)) + | Leaf a + + +derive Json (Branchy a) +derive Eq (Branchy a) +derive PlutusData (Branchy a) diff --git a/typescript-plutus/api/lbf/build.nix b/typescript-plutus/api/lbf/build.nix new file mode 100644 index 00000000..6665ae23 --- /dev/null +++ b/typescript-plutus/api/lbf/build.nix @@ -0,0 +1,17 @@ +_: +{ + perSystem = { config, ... }: + let + tsFlake = + config.lbf-nix.lbfPlutusTypescript { + name = "lbf-plutus-sample-project"; + src = ./.; + files = [ "MySchema.lbf" ]; + }; + in + { + packages = { + inherit (tsFlake.packages) lbf-plutus-sample-project-typescript lbf-plutus-sample-project-typescript-tgz; + }; + }; +} diff --git a/typescript-plutus/build.nix b/typescript-plutus/build.nix new file mode 100644 index 00000000..d3c449de --- /dev/null +++ b/typescript-plutus/build.nix @@ -0,0 +1,27 @@ +{ inputs, ... }: +{ + imports = [ ./api/lbf/build.nix ]; + + perSystem = { config, system, ... }: + let + tsFlake = + inputs.flake-lang.lib.${system}.typescriptFlake { + name = "plutus-sample-project"; + src = ./.; + + npmExtraDependencies = [ + config.packages.lbf-plutus-sample-project-typescript-tgz + ]; + + devShellTools = config.settings.shell.tools; + devShellHook = config.settings.shell.hook; + }; + in + { + packages = { + inherit (tsFlake.packages) plutus-sample-project-typescript plutus-sample-project-typescript-tgz; + }; + + inherit (tsFlake) devShells checks; + }; +} diff --git a/typescript-plutus/package-lock.json b/typescript-plutus/package-lock.json new file mode 100644 index 00000000..cae47fc4 --- /dev/null +++ b/typescript-plutus/package-lock.json @@ -0,0 +1,173 @@ +{ + "name": "lambda-buffers-prelude-sample-project", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "lambda-buffers-prelude-sample-project", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "lbf-plutus": "file:.extra-dependencies/lbf-plutus-1.0.0.tgz", + "lbf-plutus-sample-project": "file:.extra-dependencies/lbf-plutus-sample-project-1.0.0.tgz", + "lbf-prelude": "file:.extra-dependencies/lbf-prelude-1.0.0.tgz", + "lbr-plutus": "file:.extra-dependencies/lbr-plutus-1.0.0.tgz", + "lbr-prelude": "file:.extra-dependencies/lbr-prelude-1.0.0.tgz", + "plutus-ledger-api": "file:.extra-dependencies/plutus-ledger-api-1.0.0.tgz", + "prelude": "file:.extra-dependencies/prelude-1.0.1.tgz" + }, + "devDependencies": { + "typescript": "^5.3.3" + } + }, + "node_modules/lbf-plutus": { + "version": "1.0.0", + "resolved": "file:.extra-dependencies/lbf-plutus-1.0.0.tgz", + "integrity": "sha512-qgXg/icqLpy6bZtWiW7qOpfXDJwG9D99r0OsRhuGp5T/h3eNtdSt6jwOSlNniV7v4n9+MmZz0nN9rhxBnDJUHA==", + "dependencies": { + "lbf-prelude": "file:.extra-dependencies/lbf-prelude-1.0.0.tgz", + "lbr-plutus": "file:.extra-dependencies/lbr-plutus-1.0.0.tgz", + "lbr-prelude": "file:.extra-dependencies/lbr-prelude-1.0.0.tgz", + "plutus-ledger-api": "file:.extra-dependencies/plutus-ledger-api-1.0.0.tgz", + "prelude": "file:.extra-dependencies/prelude-1.0.1.tgz" + } + }, + "node_modules/lbf-plutus-sample-project": { + "version": "1.0.0", + "resolved": "file:.extra-dependencies/lbf-plutus-sample-project-1.0.0.tgz", + "integrity": "sha512-KS0wG2uVdvgmXYNCdSn+QgK0iGCBNLETlUCgDeFpZSXQ+mVqADx2kmc5qsoC/JCv+VayCWpdrGlptALTNb994Q==", + "dependencies": { + "lbf-plutus": "file:.extra-dependencies/lbf-plutus-1.0.0.tgz", + "lbf-prelude": "file:.extra-dependencies/lbf-prelude-1.0.0.tgz", + "lbr-plutus": "file:.extra-dependencies/lbr-plutus-1.0.0.tgz", + "lbr-prelude": "file:.extra-dependencies/lbr-prelude-1.0.0.tgz", + "plutus-ledger-api": "file:.extra-dependencies/plutus-ledger-api-1.0.0.tgz", + "prelude": "file:.extra-dependencies/prelude-1.0.1.tgz" + } + }, + "node_modules/lbf-prelude": { + "version": "1.0.0", + "resolved": "file:.extra-dependencies/lbf-prelude-1.0.0.tgz", + "integrity": "sha512-XLxQoeX/LBPAHSnzF7LcUBOfMziugGvVMYiC1tdKQXfmv4fxaHQK9H5nTCNVNuRS/yu6xAhmoBQCI8EUBdRBPg==", + "dependencies": { + "lbr-prelude": "file:.extra-dependencies/lbr-prelude-1.0.0.tgz", + "prelude": "file:.extra-dependencies/prelude-1.0.1.tgz" + } + }, + "node_modules/lbr-plutus": { + "version": "1.0.0", + "resolved": "file:.extra-dependencies/lbr-plutus-1.0.0.tgz", + "integrity": "sha512-loFgkNpqebifovqtpLcHD0hTladoZy8sN/vZB/mkvn+AT/MmpvKhH6FqV+/slAfuE8YJn7C0/fv6ueWixPBb7Q==", + "license": "ISC", + "dependencies": { + "lbr-prelude": "file:.extra-dependencies/lbr-prelude-1.0.0.tgz", + "plutus-ledger-api": "file:.extra-dependencies/plutus-ledger-api-1.0.0.tgz", + "prelude": "file:.extra-dependencies/prelude-1.0.1.tgz" + } + }, + "node_modules/lbr-prelude": { + "version": "1.0.0", + "resolved": "file:.extra-dependencies/lbr-prelude-1.0.0.tgz", + "integrity": "sha512-ve/VcacDc1qSwWvNciYqVPV7mzN0jzrPi1RHpVFdNEsyLPasr7/qq0vxOeIJrcnIMeDWO5K866Luy/edvq2eow==", + "license": "ISC", + "dependencies": { + "prelude": "file:.extra-dependencies/prelude-1.0.1.tgz", + "typescript": "^5.3.3" + } + }, + "node_modules/plutus-ledger-api": { + "version": "1.0.0", + "resolved": "file:.extra-dependencies/plutus-ledger-api-1.0.0.tgz", + "integrity": "sha512-CR4CshLrbu15tUu7RPA3fvzRZ/HjOsBOJJ4P144b3dtzToP2ljJ4KbCZs3pk3im71sst7fjQKdEM97B3fyMc3Q==", + "license": "ISC", + "dependencies": { + "prelude": "file:.extra-dependencies/prelude-1.0.1.tgz" + } + }, + "node_modules/prelude": { + "version": "1.0.1", + "resolved": "file:.extra-dependencies/prelude-1.0.1.tgz", + "integrity": "sha512-ucWNcpO/mDC3kgAEx/SP9yzmhWH5FgP8TY1kQpPQw8R0zGHtgpdXnmcKcl1n8s92uIDgBtIZGVUNRoEDLjGwqQ==", + "license": "ISC" + }, + "node_modules/typescript": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", + "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + } + }, + "dependencies": { + "lbf-plutus": { + "version": "file:.extra-dependencies/lbf-plutus-1.0.0.tgz", + "integrity": "sha512-qgXg/icqLpy6bZtWiW7qOpfXDJwG9D99r0OsRhuGp5T/h3eNtdSt6jwOSlNniV7v4n9+MmZz0nN9rhxBnDJUHA==", + "requires": { + "lbf-prelude": "file:.extra-dependencies/lbf-prelude-1.0.0.tgz", + "lbr-plutus": "file:.extra-dependencies/lbr-plutus-1.0.0.tgz", + "lbr-prelude": "file:.extra-dependencies/lbr-prelude-1.0.0.tgz", + "plutus-ledger-api": "file:.extra-dependencies/plutus-ledger-api-1.0.0.tgz", + "prelude": "file:.extra-dependencies/prelude-1.0.1.tgz" + } + }, + "lbf-plutus-sample-project": { + "version": "file:.extra-dependencies/lbf-plutus-sample-project-1.0.0.tgz", + "integrity": "sha512-KS0wG2uVdvgmXYNCdSn+QgK0iGCBNLETlUCgDeFpZSXQ+mVqADx2kmc5qsoC/JCv+VayCWpdrGlptALTNb994Q==", + "requires": { + "lbf-plutus": "file:.extra-dependencies/lbf-plutus-1.0.0.tgz", + "lbf-prelude": "file:.extra-dependencies/lbf-prelude-1.0.0.tgz", + "lbr-plutus": "file:.extra-dependencies/lbr-plutus-1.0.0.tgz", + "lbr-prelude": "file:.extra-dependencies/lbr-prelude-1.0.0.tgz", + "plutus-ledger-api": "file:.extra-dependencies/plutus-ledger-api-1.0.0.tgz", + "prelude": "file:.extra-dependencies/prelude-1.0.1.tgz" + } + }, + "lbf-prelude": { + "version": "file:.extra-dependencies/lbf-prelude-1.0.0.tgz", + "integrity": "sha512-XLxQoeX/LBPAHSnzF7LcUBOfMziugGvVMYiC1tdKQXfmv4fxaHQK9H5nTCNVNuRS/yu6xAhmoBQCI8EUBdRBPg==", + "requires": { + "lbr-prelude": "file:.extra-dependencies/lbr-prelude-1.0.0.tgz", + "prelude": "file:.extra-dependencies/prelude-1.0.1.tgz" + } + }, + "lbr-plutus": { + "version": "file:.extra-dependencies/lbr-plutus-1.0.0.tgz", + "integrity": "sha512-loFgkNpqebifovqtpLcHD0hTladoZy8sN/vZB/mkvn+AT/MmpvKhH6FqV+/slAfuE8YJn7C0/fv6ueWixPBb7Q==", + "requires": { + "lbr-prelude": "file:.extra-dependencies/lbr-prelude-1.0.0.tgz", + "plutus-ledger-api": "file:.extra-dependencies/plutus-ledger-api-1.0.0.tgz", + "prelude": "file:.extra-dependencies/prelude-1.0.1.tgz" + } + }, + "lbr-prelude": { + "version": "file:.extra-dependencies/lbr-prelude-1.0.0.tgz", + "integrity": "sha512-ve/VcacDc1qSwWvNciYqVPV7mzN0jzrPi1RHpVFdNEsyLPasr7/qq0vxOeIJrcnIMeDWO5K866Luy/edvq2eow==", + "requires": { + "prelude": "file:.extra-dependencies/prelude-1.0.1.tgz", + "typescript": "^5.3.3" + } + }, + "plutus-ledger-api": { + "version": "file:.extra-dependencies/plutus-ledger-api-1.0.0.tgz", + "integrity": "sha512-CR4CshLrbu15tUu7RPA3fvzRZ/HjOsBOJJ4P144b3dtzToP2ljJ4KbCZs3pk3im71sst7fjQKdEM97B3fyMc3Q==", + "requires": { + "prelude": "file:.extra-dependencies/prelude-1.0.1.tgz" + } + }, + "prelude": { + "version": "file:.extra-dependencies/prelude-1.0.1.tgz", + "integrity": "sha512-ucWNcpO/mDC3kgAEx/SP9yzmhWH5FgP8TY1kQpPQw8R0zGHtgpdXnmcKcl1n8s92uIDgBtIZGVUNRoEDLjGwqQ==" + }, + "typescript": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", + "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==" + } + } +} diff --git a/typescript-plutus/package.json b/typescript-plutus/package.json new file mode 100644 index 00000000..bc398e91 --- /dev/null +++ b/typescript-plutus/package.json @@ -0,0 +1,32 @@ +{ + "name": "lambda-buffers-prelude-sample-project", + "version": "1.0.0", + "description": "Sample project for LambdaBuffers", + "type": "module", + "exports": { + ".": "./dist/index.mjs", + "./package.json": "./package.json" + }, + "scripts": { + "build": "npx tsc -b src/", + "test": ":" + }, + "author": "Jared Pon", + "license": "ISC", + "files": [ + "./dist/**/*", + "./.extra-dependencies/**/*" + ], + "devDependencies": { + "typescript": "^5.3.3" + }, + "dependencies": { + "lbf-plutus": "file:.extra-dependencies/lbf-plutus-1.0.0.tgz", + "lbf-plutus-sample-project": "file:.extra-dependencies/lbf-plutus-sample-project-1.0.0.tgz", + "lbf-prelude": "file:.extra-dependencies/lbf-prelude-1.0.0.tgz", + "lbr-plutus": "file:.extra-dependencies/lbr-plutus-1.0.0.tgz", + "lbr-prelude": "file:.extra-dependencies/lbr-prelude-1.0.0.tgz", + "plutus-ledger-api": "file:.extra-dependencies/plutus-ledger-api-1.0.0.tgz", + "prelude": "file:.extra-dependencies/prelude-1.0.1.tgz" + } +} diff --git a/typescript-plutus/src/index.mts b/typescript-plutus/src/index.mts new file mode 100644 index 00000000..bacbb6b5 --- /dev/null +++ b/typescript-plutus/src/index.mts @@ -0,0 +1,126 @@ +// Simple plutus sample project. +// To run, type +// ``` +// npm run build && node ./dist/src/index.mjs +// ``` +import * as LbrPlutusV1 from "lbr-plutus/V1.js"; +import * as LbrPlutusPd from "lbr-plutus/PlutusData.js"; +import * as LbrPrelude from "lbr-prelude"; +import * as Prelude from "prelude"; +import * as MySchema from "lbf-plutus-sample-project/LambdaBuffers/MySchema.mjs"; + +const pubKeyHash: LbrPlutusV1.PubKeyHash = new Uint8Array([ + 0, + 0, +]) as LbrPlutusV1.PubKeyHash; + +const cred: LbrPlutusV1.Credential = { + name: "PubKeyCredential", + fields: pubKeyHash, +}; + +console.log(`Some samples of PubKeyHash and Credential`); +console.log(pubKeyHash); +console.log(cred); + +// Printing the leafy type +console.log(`The Leaf constructor`); +const leaf: MySchema.Branchy = { + name: "Leaf", + fields: cred, +}; +const leafpd: LbrPlutusV1.PlutusData = LbrPlutusPd.IsPlutusData + [MySchema.Branchy]( + LbrPlutusPd.IsPlutusData[LbrPlutusV1.Credential], + ).toData(leaf); + +console.log(leafpd); +console.log( + `Prelude.Json: ${ + Prelude.stringify( + LbrPrelude.Json[MySchema.Branchy](LbrPrelude.Json[LbrPlutusV1.Credential]) + .toJson(leaf), + ) + }`, +); +console.log( + `Prelude.Json: ${ + Prelude.stringify(LbrPrelude.Json[LbrPlutusV1.PlutusData].toJson(leafpd)) + }`, +); + +console.log("fromData:"); +console.log( + LbrPlutusPd.IsPlutusData[MySchema.Branchy]( + LbrPlutusPd.IsPlutusData[LbrPlutusV1.Credential], + ).fromData(leafpd), +); + +// Printing the branchy +console.log(`The Node constructor`); +const branchy: MySchema.Branchy = { + name: "Node", + fields: [leafpd, { name: "Finite", fields: leaf }], +}; +const branchypd: LbrPlutusV1.PlutusData = LbrPlutusPd.IsPlutusData + [MySchema.Branchy](LbrPlutusPd.IsPlutusData[LbrPlutusV1.Credential]).toData( + branchy, + ); + +console.log("toData:"); +console.log(branchypd); + +console.log( + `Prelude.Json: ${ + Prelude.stringify( + LbrPrelude.Json[MySchema.Branchy](LbrPrelude.Json[LbrPlutusV1.Credential]) + .toJson(branchy), + ) + }`, +); +console.log( + `Prelude.Json: ${ + Prelude.stringify(LbrPrelude.Json[LbrPlutusV1.PlutusData].toJson(branchypd)) + }`, +); + +console.log("fromData:"); +console.log( + LbrPlutusPd.IsPlutusData[MySchema.Branchy]( + LbrPlutusPd.IsPlutusData[LbrPlutusV1.Credential], + ).fromData(branchypd), +); + +// Printing the Eq +console.log( + `branchy is branchy: ${ + LbrPrelude.Eq[MySchema.Branchy](LbrPrelude.Eq[LbrPlutusV1.Credential]).eq( + branchy, + branchy, + ) + }`, +); +console.log( + `branchy is not branchy: ${ + LbrPrelude.Eq[MySchema.Branchy](LbrPrelude.Eq[LbrPlutusV1.Credential]).neq( + branchy, + branchy, + ) + }`, +); +console.log( + `branchy is leaf: ${ + LbrPrelude.Eq[MySchema.Branchy](LbrPrelude.Eq[LbrPlutusV1.Credential]).eq( + branchy, + leaf, + ) + }`, +); +console.log( + `branchy is not leaf: ${ + LbrPrelude.Eq[MySchema.Branchy](LbrPrelude.Eq[LbrPlutusV1.Credential]).neq( + branchy, + leaf, + ) + }`, +); diff --git a/typescript-plutus/src/tsconfig.json b/typescript-plutus/src/tsconfig.json new file mode 100644 index 00000000..fcab6f23 --- /dev/null +++ b/typescript-plutus/src/tsconfig.json @@ -0,0 +1,5 @@ +{ + "extends": "../tsconfig-base", + "include": ["*"], + "references": [ ] +} diff --git a/typescript-plutus/tsconfig-base.json b/typescript-plutus/tsconfig-base.json new file mode 100644 index 00000000..56c4c468 --- /dev/null +++ b/typescript-plutus/tsconfig-base.json @@ -0,0 +1,109 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + + /* Language and Environment */ + "target": "es2020", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "preserve", /* Specify what JSX code is generated. */ + // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ + // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "node16", /* Specify what module code is generated. */ + "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ + // "types": [], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ + // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ + // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ + // "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + "outDir": "./dist", /* Specify an output folder for all emitted files. */ + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ + /// "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + // "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + } +} diff --git a/typescript-prelude/.gitignore b/typescript-prelude/.gitignore new file mode 100644 index 00000000..28bd684b --- /dev/null +++ b/typescript-prelude/.gitignore @@ -0,0 +1 @@ +extra-dependencies/ diff --git a/typescript-prelude/api/lbf/MySchema.lbf b/typescript-prelude/api/lbf/MySchema.lbf new file mode 100644 index 00000000..764cf825 --- /dev/null +++ b/typescript-prelude/api/lbf/MySchema.lbf @@ -0,0 +1,11 @@ +module MySchema + +import Prelude + +sum Branchy a + = Node Integer (List (Branchy a)) + | Leaf a + + +derive Eq (Branchy a) +derive Json (Branchy a) diff --git a/typescript-prelude/api/lbf/build.nix b/typescript-prelude/api/lbf/build.nix new file mode 100644 index 00000000..d4b983bb --- /dev/null +++ b/typescript-prelude/api/lbf/build.nix @@ -0,0 +1,17 @@ +_: +{ + perSystem = { config, ... }: + let + tsFlake = + config.lbf-nix.lbfPreludeTypescript { + name = "lbf-prelude-sample-project"; + src = ./.; + files = [ "MySchema.lbf" ]; + }; + in + { + packages = { + inherit (tsFlake.packages) lbf-prelude-sample-project-typescript lbf-prelude-sample-project-typescript-tgz; + }; + }; +} diff --git a/typescript-prelude/build.nix b/typescript-prelude/build.nix new file mode 100644 index 00000000..e83f1078 --- /dev/null +++ b/typescript-prelude/build.nix @@ -0,0 +1,26 @@ +{ inputs, ... }: +{ + imports = [ ./api/lbf/build.nix ]; + + perSystem = { config, system, ... }: + let + tsFlake = + inputs.flake-lang.lib.${system}.typescriptFlake { + name = "prelude-sample-project"; + src = ./.; + npmExtraDependencies = [ + config.packages.lbf-prelude-sample-project-typescript-tgz + ]; + + devShellTools = config.settings.shell.tools; + devShellHook = config.settings.shell.hook; + }; + in + { + packages = { + inherit (tsFlake.packages) prelude-sample-project-typescript prelude-sample-project-typescript-tgz; + }; + + inherit (tsFlake) devShells checks; + }; +} diff --git a/typescript-prelude/package-lock.json b/typescript-prelude/package-lock.json new file mode 100644 index 00000000..f3854364 --- /dev/null +++ b/typescript-prelude/package-lock.json @@ -0,0 +1,105 @@ +{ + "name": "lambda-buffers-prelude-sample-project", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "lambda-buffers-prelude-sample-project", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "lbf-prelude": "file:.extra-dependencies/lbf-prelude-1.0.0.tgz", + "lbf-prelude-sample-project": "file:.extra-dependencies/lbf-prelude-sample-project-1.0.0.tgz", + "lbr-prelude": "file:.extra-dependencies/lbr-prelude-1.0.0.tgz", + "prelude": "file:.extra-dependencies/prelude-1.0.1.tgz" + }, + "devDependencies": { + "typescript": "^5.3.3" + } + }, + "node_modules/lbf-prelude": { + "version": "1.0.0", + "resolved": "file:.extra-dependencies/lbf-prelude-1.0.0.tgz", + "integrity": "sha512-XLxQoeX/LBPAHSnzF7LcUBOfMziugGvVMYiC1tdKQXfmv4fxaHQK9H5nTCNVNuRS/yu6xAhmoBQCI8EUBdRBPg==", + "dependencies": { + "lbr-prelude": "file:.extra-dependencies/lbr-prelude-1.0.0.tgz", + "prelude": "file:.extra-dependencies/prelude-1.0.1.tgz" + } + }, + "node_modules/lbf-prelude-sample-project": { + "version": "1.0.0", + "resolved": "file:.extra-dependencies/lbf-prelude-sample-project-1.0.0.tgz", + "integrity": "sha512-o1ik3TcPl9NIBKB1JFEY/GZBTizx5JZ7nqshACz4GuadolK79W90YspmvmNP/oLe2P3HUjw2UBYG+sdNRHzQbg==", + "dependencies": { + "lbf-prelude": "file:.extra-dependencies/lbf-prelude-1.0.0.tgz", + "lbr-prelude": "file:.extra-dependencies/lbr-prelude-1.0.0.tgz", + "prelude": "file:.extra-dependencies/prelude-1.0.1.tgz" + } + }, + "node_modules/lbr-prelude": { + "version": "1.0.0", + "resolved": "file:.extra-dependencies/lbr-prelude-1.0.0.tgz", + "integrity": "sha512-ve/VcacDc1qSwWvNciYqVPV7mzN0jzrPi1RHpVFdNEsyLPasr7/qq0vxOeIJrcnIMeDWO5K866Luy/edvq2eow==", + "license": "ISC", + "dependencies": { + "prelude": "file:.extra-dependencies/prelude-1.0.1.tgz", + "typescript": "^5.3.3" + } + }, + "node_modules/prelude": { + "version": "1.0.1", + "resolved": "file:.extra-dependencies/prelude-1.0.1.tgz", + "integrity": "sha512-ucWNcpO/mDC3kgAEx/SP9yzmhWH5FgP8TY1kQpPQw8R0zGHtgpdXnmcKcl1n8s92uIDgBtIZGVUNRoEDLjGwqQ==", + "license": "ISC" + }, + "node_modules/typescript": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", + "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + } + }, + "dependencies": { + "lbf-prelude": { + "version": "file:.extra-dependencies/lbf-prelude-1.0.0.tgz", + "integrity": "sha512-XLxQoeX/LBPAHSnzF7LcUBOfMziugGvVMYiC1tdKQXfmv4fxaHQK9H5nTCNVNuRS/yu6xAhmoBQCI8EUBdRBPg==", + "requires": { + "lbr-prelude": "file:.extra-dependencies/lbr-prelude-1.0.0.tgz", + "prelude": "file:..extra-dependencies/prelude-1.0.1.tgz" + } + }, + "lbf-prelude-sample-project": { + "version": "file:.extra-dependencies/lbf-prelude-sample-project-1.0.0.tgz", + "integrity": "sha512-o1ik3TcPl9NIBKB1JFEY/GZBTizx5JZ7nqshACz4GuadolK79W90YspmvmNP/oLe2P3HUjw2UBYG+sdNRHzQbg==", + "requires": { + "lbf-prelude": "file:.extra-dependencies/lbf-prelude-1.0.0.tgz", + "lbr-prelude": "file:.extra-dependencies/lbr-prelude-1.0.0.tgz", + "prelude": "file:.extra-dependencies/prelude-1.0.1.tgz" + } + }, + "lbr-prelude": { + "version": "file:.extra-dependencies/lbr-prelude-1.0.0.tgz", + "integrity": "sha512-ve/VcacDc1qSwWvNciYqVPV7mzN0jzrPi1RHpVFdNEsyLPasr7/qq0vxOeIJrcnIMeDWO5K866Luy/edvq2eow==", + "requires": { + "prelude": "file:.extra-dependencies/prelude-1.0.1.tgz", + "typescript": "^5.3.3" + } + }, + "prelude": { + "version": "file:.extra-dependencies/prelude-1.0.1.tgz", + "integrity": "sha512-ucWNcpO/mDC3kgAEx/SP9yzmhWH5FgP8TY1kQpPQw8R0zGHtgpdXnmcKcl1n8s92uIDgBtIZGVUNRoEDLjGwqQ==" + }, + "typescript": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", + "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==" + } + } +} diff --git a/typescript-prelude/package.json b/typescript-prelude/package.json new file mode 100644 index 00000000..9048b3ca --- /dev/null +++ b/typescript-prelude/package.json @@ -0,0 +1,29 @@ +{ + "name": "lambda-buffers-prelude-sample-project", + "version": "1.0.0", + "description": "Sample project for LambdaBuffers", + "type": "module", + "exports": { + ".": "./dist/index.mjs", + "./package.json": "./package.json" + }, + "scripts": { + "build": "npx tsc -b src/", + "test": ":" + }, + "author": "Jared Pon", + "license": "ISC", + "files": [ + "./dist/**/*", + "./.extra-dependencies/**/*" + ], + "devDependencies": { + "typescript": "^5.3.3" + }, + "dependencies": { + "lbf-prelude": "file:.extra-dependencies/lbf-prelude-1.0.0.tgz", + "lbf-prelude-sample-project": "file:.extra-dependencies/lbf-prelude-sample-project-1.0.0.tgz", + "lbr-prelude": "file:.extra-dependencies/lbr-prelude-1.0.0.tgz", + "prelude": "file:.extra-dependencies/prelude-1.0.1.tgz" + } +} diff --git a/typescript-prelude/src/index.mts b/typescript-prelude/src/index.mts new file mode 100644 index 00000000..a1d82d1d --- /dev/null +++ b/typescript-prelude/src/index.mts @@ -0,0 +1,61 @@ +// Simple prelude sample project. +// To run, type +// ``` +// npm run build && node ./dist/src/index.mjs +// ``` +import * as Prelude from "prelude"; +import * as PreludeJson from "prelude/Json.js"; +import * as LbrPrelude from "lbr-prelude"; +import * as MySchema from "lbf-prelude-sample-project/LambdaBuffers/MySchema.mjs"; + +const a: MySchema.Branchy = { + name: "Node", + fields: [420n, [{ name: "Leaf", fields: true }, { + name: "Leaf", + fields: false, + }]], +}; +const b: MySchema.Branchy = { name: "Leaf", fields: false }; + +a; + +console.log("a == a"); +console.log( + LbrPrelude.Eq[MySchema.Branchy](LbrPrelude.Eq[LbrPrelude.Bool]).eq(a, a), +); +console.log("a == b"); +console.log( + LbrPrelude.Eq[MySchema.Branchy](LbrPrelude.Eq[LbrPrelude.Bool]).eq(a, b), +); + +console.log("a != a"); +console.log( + LbrPrelude.Eq[MySchema.Branchy](LbrPrelude.Eq[LbrPrelude.Bool]).neq(a, a), +); +console.log("a != b"); +console.log( + LbrPrelude.Eq[MySchema.Branchy](LbrPrelude.Eq[LbrPrelude.Bool]).neq(a, b), +); + +console.log("toJson(a)"); +console.log( + PreludeJson.stringify( + LbrPrelude.Json[MySchema.Branchy](LbrPrelude.Json[LbrPrelude.Bool]) + .toJson(a), + ), +); + +console.log("fromJson(toJson(a))"); +console.log( + JSON.stringify( + LbrPrelude.Json[MySchema.Branchy](LbrPrelude.Json[LbrPrelude.Bool]) + .fromJson( + LbrPrelude.Json[MySchema.Branchy](LbrPrelude.Json[LbrPrelude.Bool]) + .toJson(a), + ), + (_key, value) => { + if (typeof value === "bigint") return (value.toString()); + else return value; + }, + ), +); diff --git a/typescript-prelude/src/tsconfig.json b/typescript-prelude/src/tsconfig.json new file mode 100644 index 00000000..fcab6f23 --- /dev/null +++ b/typescript-prelude/src/tsconfig.json @@ -0,0 +1,5 @@ +{ + "extends": "../tsconfig-base", + "include": ["*"], + "references": [ ] +} diff --git a/typescript-prelude/tsconfig-base.json b/typescript-prelude/tsconfig-base.json new file mode 100644 index 00000000..56c4c468 --- /dev/null +++ b/typescript-prelude/tsconfig-base.json @@ -0,0 +1,109 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + + /* Language and Environment */ + "target": "es2020", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "preserve", /* Specify what JSX code is generated. */ + // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ + // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "node16", /* Specify what module code is generated. */ + "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ + // "types": [], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ + // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ + // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ + // "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + "outDir": "./dist", /* Specify an output folder for all emitted files. */ + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ + /// "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + // "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + } +}