fix: declarations
This commit is contained in:
parent
71b81704e6
commit
30de5b9423
11 changed files with 21 additions and 11 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -19,6 +19,7 @@
|
|||
|
||||
# sources
|
||||
!/src
|
||||
!/scripts
|
||||
|
||||
# builded
|
||||
!/lib
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
export * from "./str.mjs";
|
||||
export * from "./nodes.mjs";
|
||||
export * from "./types.mjs";
|
3
lib/index.d.ts
vendored
Normal file
3
lib/index.d.ts
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
export * from "./str.js";
|
||||
export * from "./nodes.js";
|
||||
export * from "./types.js";
|
0
lib/lang.d.mts → lib/lang.d.ts
vendored
0
lib/lang.d.mts → lib/lang.d.ts
vendored
2
lib/nodes.d.mts → lib/nodes.d.ts
vendored
2
lib/nodes.d.mts → lib/nodes.d.ts
vendored
|
@ -1,4 +1,4 @@
|
|||
import { Nilable } from "./lang.mjs";
|
||||
import { Nilable } from "./lang.js";
|
||||
export declare type AnyNode = AnySyncNode | AnyAsyncNode;
|
||||
export declare type AnyAsyncNode = Promise<AnySyncNode>;
|
||||
export declare type AnySyncNode = TextNode | Elem | Frag;
|
4
lib/str.d.mts → lib/str.d.ts
vendored
4
lib/str.d.mts → lib/str.d.ts
vendored
|
@ -1,5 +1,5 @@
|
|||
import { Renderer } from "./types.mjs";
|
||||
import { Elem } from "./nodes.mjs";
|
||||
import { Renderer } from "./types.js";
|
||||
import { Elem } from "./nodes.js";
|
||||
export declare class StrRenderer implements Renderer<string> {
|
||||
render(node: Elem | Promise<Elem>): Promise<string>;
|
||||
}
|
2
lib/types.d.mts → lib/types.d.ts
vendored
2
lib/types.d.mts → lib/types.d.ts
vendored
|
@ -1,4 +1,4 @@
|
|||
import { Elem } from "./nodes.mjs";
|
||||
import { Elem } from "./nodes.js";
|
||||
export interface Renderer<T> {
|
||||
render(node: Elem | Promise<Elem>): Promise<T>;
|
||||
}
|
7
makefile
7
makefile
|
@ -1,9 +1,12 @@
|
|||
|
||||
ts:
|
||||
npx tsc
|
||||
npx tsc && make fix-decl
|
||||
|
||||
ts-w:
|
||||
npx tsc-watch
|
||||
npx tsc-watch --onSuccess "make fix-decl"
|
||||
|
||||
fix-decl:
|
||||
./scripts/fix_decl.sh
|
||||
|
||||
clean:
|
||||
rm -rf lib
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"description": "",
|
||||
"version": "0.0.1",
|
||||
"main": "lib/index.mjs",
|
||||
"types": "lib/index.d.mts",
|
||||
"types": "lib/index.d.ts",
|
||||
"directories": {
|
||||
"lib": "lib",
|
||||
"src": "src"
|
||||
|
|
6
scripts/fix_decl.sh
Executable file
6
scripts/fix_decl.sh
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
for f in lib/*.d.mts;
|
||||
do
|
||||
sed -i 's/.mjs"/.js"/' "$f"
|
||||
mv "$f" "${f//\.d\.mts/.d.ts}"
|
||||
done
|
|
@ -17,6 +17,6 @@
|
|||
"noImplicitAny": true
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
"src/**/*.mts"
|
||||
],
|
||||
}
|
||||
|
|
Reference in a new issue