diff --git a/bun.lockb b/bun.lockb
index 7b2c469..6c70597 100755
Binary files a/bun.lockb and b/bun.lockb differ
diff --git a/package.json b/package.json
index 1953b46..2c81aae 100644
--- a/package.json
+++ b/package.json
@@ -7,14 +7,15 @@
"main": "dist/index.cjs",
"module": "dist/index.esm.js",
"types": "dist/index.d.ts",
+ "type": "module",
"sideEffects": false,
"private": false,
"license": "Apache-2.0",
"devDependencies": {
"prettier": "^3.3.1",
- "rollup": "^1.23.1",
- "rollup-plugin-typescript2": "^0.24.3",
- "typescript": "^3.6.3",
+ "rollup": "^4.18.0",
+ "rollup-plugin-typescript2": "^0.36.0",
+ "typescript": "^5.4.5",
"vitest": "^1.6.0"
},
"bugs": {
@@ -32,9 +33,7 @@
],
"scripts": {
"test": "vitest",
- "build:tsd": "rm -rf dist && tsc src/index.ts --emitDeclarationOnly -d --outDir dist",
- "rollup": "rollup -c",
- "build": "bun run build:tsd && bun run rollup",
+ "build": "bun run rollup -c",
"deploy": "bun run build && bun run publish",
"pretty": "prettier --check 'src/**/*.ts'",
"pretty-fix": "prettier --write 'src/**/*.ts'"
diff --git a/rollup.config.js b/rollup.config.js
index b01aed1..db7d0c4 100644
--- a/rollup.config.js
+++ b/rollup.config.js
@@ -1,24 +1,19 @@
-import typescript from 'rollup-plugin-typescript2'
-import { RollupOptions } from "rollup";
+import typescriptPlugin from "rollup-plugin-typescript2"
+import typescript from "typescript"
-/** @type {RollupOptions} */
export default {
- input: 'src/index.ts',
+ input: "src/index.ts",
output: [
{
- name: 'pratica',
- format: 'cjs',
- file: 'dist/index.cjs'
+ name: "pratica",
+ format: "cjs",
+ file: "dist/index.cjs",
},
{
- name: 'pratica',
- format: 'es',
- file: 'dist/index.esm.js'
- }
- ],
- plugins: [
- typescript({
- typescript: require('typescript'),
- })
+ name: "pratica",
+ format: "es",
+ file: "dist/index.esm.js",
+ },
],
-}
\ No newline at end of file
+ plugins: [typescriptPlugin({ typescript, tsconfig: "tsconfig.build.json" })],
+}
diff --git a/src/encase.ts b/src/encase.ts
index 7405106..fdaf66b 100644
--- a/src/encase.ts
+++ b/src/encase.ts
@@ -13,6 +13,6 @@ export const encaseRes = (func: () => A): Result => {
try {
return Ok(func())
} catch (e) {
- return Err(e)
+ return Err(e as E)
}
}
diff --git a/src/parseDate.ts b/src/parseDate.ts
index 207af74..848a873 100644
--- a/src/parseDate.ts
+++ b/src/parseDate.ts
@@ -1,6 +1,6 @@
import { nullable, Maybe, Nothing, Just } from "./maybe"
-export const parseDate = (date: string | number | Date | undefined | null): Maybe =>
+export const parseDate = (date: string | number | undefined | null): Maybe =>
nullable(date)
.map((d) => new Date(d))
.chain((d) => (isNaN(d.valueOf()) ? Nothing : Just(d)))
diff --git a/tsconfig.build.json b/tsconfig.build.json
new file mode 100644
index 0000000..38700f4
--- /dev/null
+++ b/tsconfig.build.json
@@ -0,0 +1,25 @@
+{
+ "compilerOptions": {
+ "target": "ES2020",
+ "useDefineForClassFields": true,
+ "module": "ES2020",
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
+ "skipLibCheck": true,
+ "declaration": true,
+ "outDir": "dist",
+
+ /* Bundler mode */
+ "moduleResolution": "Bundler",
+ "resolveJsonModule": true,
+ "isolatedModules": true,
+
+ /* Linting */
+ "strict": true,
+ "noFallthroughCasesInSwitch": true,
+ "strictNullChecks": true,
+
+ /* Sourcemaps */
+ "sourceMap": true,
+ },
+ "include": ["src"]
+}
\ No newline at end of file
diff --git a/tsconfig.json b/tsconfig.json
index 86bd506..88a3f2e 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,16 +1,25 @@
{
"compilerOptions": {
- "target": "es5",
- "lib": ["dom", "dom.iterable", "esnext"],
+ "target": "ES2020",
+ "useDefineForClassFields": true,
+ "module": "ES2020",
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,
- "esModuleInterop": true,
- "allowSyntheticDefaultImports": true,
- "strict": true,
- "forceConsistentCasingInFileNames": true,
- "module": "esnext",
- "moduleResolution": "node",
+ "declaration": true,
+ "outDir": "dist",
+
+ /* Bundler mode */
+ "moduleResolution": "Bundler",
"resolveJsonModule": true,
- "noEmit": true
+ "isolatedModules": true,
+
+ /* Linting */
+ "strict": true,
+ "noFallthroughCasesInSwitch": true,
+ "strictNullChecks": true,
+
+ /* Sourcemaps */
+ "sourceMap": true,
},
"include": ["src", "specs"]
}
\ No newline at end of file