Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed #cocos-engine/16594: Missing abstract keyword for AbstractedConstructor in cc.d.ts #1

Merged
merged 5 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
node-version: 18
- run: npm install
- id: publish
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_AUTH_TOKEN }}
token: ${{ secrets.NPM_PUBLISH_FOR_PUBLIC_REPO }}
- if: steps.publish.outputs.type != 'none'
run: |
echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}"
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tfig",
"version": "3.3.2",
"version": "3.3.3",
"description": "Yet another tool to generate .d.ts bundle.",
"main": "build/gift.js",
"types": "build/gift.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion source/recast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ export function recastTopLevelModule({
);
} else if (ts.isConstructorTypeNode(type)) {
return nodeFactor.createConstructorTypeNode(
undefined,
recastModifiers(type.modifiers),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modifier abstract keyword was missing here since it's undefined before.

recastTypeParameterArray(type.typeParameters),
recastParameterArray(type.parameters), // parameters
recastTypeNode(type.type),
Expand Down
3 changes: 2 additions & 1 deletion test/types/@types/globals.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@

declare type Constructor<T = unknown> = new(...args: any[]) => T;
declare type Constructor<T = unknown> = new(...args: any[]) => T;
declare type AbstractedConstructor<T = unknown> = abstract new (...args: any[]) => T;
2 changes: 1 addition & 1 deletion test/types/input.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ declare module "index" {
export class Component {}

export class Node {
getComponent<T extends Component>(constructor: Constructor<T>): T | null;
getComponent<T extends Component>(constructor: Constructor<T> | AbstractedConstructor<T>): T | null;
}
}