Socket
Socket
Sign inDemoInstall

ts-pattern

Package Overview
Dependencies
Maintainers
1
Versions
151
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-pattern - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

6

package.json
{
"name": "ts-pattern",
"version": "0.1.0",
"version": "0.1.1",
"description": "Typescript pattern matching library",

@@ -10,3 +10,5 @@ "main": "lib/index.js",

"prepare": "npm run test && npm run clean && npm run build",
"test": "jest"
"test:values": "jest",
"test:types": "tsc --project tests/tsconfig.json",
"test": "npm run test:types && npm run test:values"
},

@@ -13,0 +15,0 @@ "repository": {

@@ -382,2 +382,18 @@ import { match, __, Pattern } from '../src';

});
it('should narrow down the value type based on type guard', () => {
let n = 20;
const res = match<number, boolean>(n)
.when(
(x): x is 13 => x === 13,
(x) => {
const inferenceCheck: 13 = x;
return true;
}
)
.otherwise(() => false)
.run();
const inferenceCheck: boolean = res;
});
});

@@ -384,0 +400,0 @@

{
"compilerOptions": {
"strict": true
}
"strict": true,
"downlevelIteration": true,
"noEmit": true
},
"exclude": ["src/"]
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc