-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
Using Typescript: Could not find a declaration file for module 'ecctrl' #25
Comments
I could fix it by simply adding a new file at the root of my project called Using NextJS v14.04 |
I've faced the same issue on Vite project. I've just walked it around with provided code snippet
I hope this type declaration issue will be fixed with next patch |
We can add a declaration file to our project to fix this: // ecctrl.d.ts
declare module "ecctrl" {
export * from "ecctrl/src/Ecctrl";
import Ecctrl from "ecctrl/src/Ecctrl";
export = Ecctrl;
} That didn't work: lib type constraints conflicted with mine. Here's enough to get default export working.// ecctrl.d.ts
declare module "ecctrl" {
import type { RigidBodyProps, RapierRigidBody } from "@react-three/rapier";
export interface EcctrlProps extends RigidBodyProps {
children?: ReactNode;
debug?: boolean;
capsuleHalfHeight?: number;
capsuleRadius?: number;
floatHeight?: number;
characterInitDir?: number;
followLight?: boolean;
disableFollowCam?: boolean;
disableFollowCamPos?: { x: number; y: number; z: number };
disableFollowCamTarget?: { x: number; y: number; z: number };
// Follow camera setups
camInitDis?: number;
camMaxDis?: number;
camMinDis?: number;
camInitDir?: { x: number; y: number; z: number };
camTargetPos?: { x: number; y: number; z: number };
camMoveSpeed?: number;
camZoomSpeed?: number;
camCollision?: boolean;
camCollisionOffset?: number;
// Follow light setups
followLightPos?: { x: number; y: number; z: number };
// Base control setups
maxVelLimit?: number;
turnVelMultiplier?: number;
turnSpeed?: number;
sprintMult?: number;
jumpVel?: number;
jumpForceToGroundMult?: number;
slopJumpMult?: number;
sprintJumpMult?: number;
airDragMultiplier?: number;
dragDampingC?: number;
accDeltaTime?: number;
rejectVelMult?: number;
moveImpulsePointY?: number;
camFollowMult?: number;
fallingGravityScale?: number;
fallingMaxVel?: number;
wakeUpDelay?: number;
// Floating Ray setups
rayOriginOffest?: { x: number; y: number; z: number };
rayHitForgiveness?: number;
rayLength?: number;
rayDir?: { x: number; y: number; z: number };
floatingDis?: number;
springK?: number;
dampingC?: number;
// Slope Ray setups
showSlopeRayOrigin?: boolean;
slopeMaxAngle?: number;
slopeRayOriginOffest?: number;
slopeRayLength?: number;
slopeRayDir?: { x: number; y: number; z: number };
slopeUpExtraForce?: number;
slopeDownExtraForce?: number;
// Head Ray setups
showHeadRayOrigin?: boolean;
headRayOriginOffest?: number;
headRayLength?: number;
headRayDir?: { x: number; y: number; z: number };
// AutoBalance Force setups
autoBalance?: boolean;
autoBalanceSpringK?: number;
autoBalanceDampingC?: number;
autoBalanceSpringOnY?: number;
autoBalanceDampingOnY?: number;
// Animation temporary setups
animated?: boolean;
// Mode setups
mode?: string;
// Controller setups
controllerKeys?: {
forward?: number;
backward?: number;
leftward?: number;
rightward?: number;
jump?: number;
action1?: number;
action2?: number;
action3?: number;
action4?: number;
};
// Other rigibody props from parent
props?: RigidBodyProps;
}
const Ecctrl: React.ForwardRefExoticComponent<EcctrlProps & React.RefAttributes<RapierRigidBody>>;
export = Ecctrl;
} |
After some research I've found a last version of the package that has a type declaration file. It's I guess it is a kind of a ci problem. Because locally I can build the package with a type declaration file (current main) running a @ErdongChen-Andrew |
Thank you @myznikovgleb ! My bad! In version 1.0.67, a type declaration file should be included. Thanks again for pointing this out! |
Is the declaration file just meant to say This seems to cause TypeScript to attempt compilation of the |
🤔 Emm, not sure about the problem. 1.0.67 was able to fix the declaration issue in my test project. |
Still having this issue on latest version, any news? |
Just made some updates, try on v1.0.75. Let me know if it works. |
I still have this issue with Indeed, the I've cloned this repo and tested the build script and it generates the type definitions. Unfortunately it seems like a CI bug indeed so I can't really help with a PR. |
My bad, @tiborsaas. version |
Hi,
I am excited to use ecctrl, however I am getting the following error when importing the module.
Type error: Could not find a declaration file for module 'ecctrl'. '/Users/konstantinlackner/Dev/konchord-experience-demo/node_modules/ecctrl/dist/Ecctrl.js' implicitly has an 'any' type. Try npm i --save-dev @types/ecctrl if it exists or add a new declaration (.d.ts) file containing declare module 'ecctrl';
I tried
npm i --save-dev @types/ecctrl
but it is not in the npm registry.Any idea how to fix this?
The text was updated successfully, but these errors were encountered: