It tells me that I can use the method after writing "MyConstructor.(here it suggests that I can use the method)", although this is not the case

I just have one question. Is it possible to separate methods from properties and signals using typing??

--!strict

local Types = {}

type self = {
	_animations: {},
	AnimationMode: number,
	_humanoid: Humanoid,
	_destroyed: boolean,
	_joints: {},
	_transforms: {},
	_jointTrackers: {},
	_stepped: RBXScriptConnection | nil,
	_descendantAdded: RBXScriptConnection | nil,
	_descendantRemoving: RBXScriptConnection | nil,
}

export type Module = { new: (humanoid: Humanoid) -> Animator }

export type Animator = {
	AnimationMode: number?;
	LoadAnimation: (self:Animator,keyframeSequence: KeyframeSequence) -> AnimationTrack;
	Destroy: (self:Animator) -> ();
}

export type AnimationTrack = {
	
	Play: (self:AnimationTrack, fadeTime:number?, weight:number?, speed:number?) -> ();
	Stop: (self:AnimationTrack, fadeTime:number?) -> ();
	AdjustSpeed: (self:AnimationTrack,speed:number?) -> ();
	AdjustWeight: (self:AnimationTrack,weight:number?,fadeTime:number?) -> ();

	Name: string?;
	Speed: number?;
	Weight: number?;
	Length: number?;
	IsPlaying: BoolValue;
	Looped: BoolValue;
	Priority: any;
	
	DidLoop: RBXScriptSignal;
	Ended: RBXScriptSignal;
	Stopped: RBXScriptSignal;
	KeyframeReached: RBXScriptSignal;
}

return Types

so I typed the methods I needed using it in another module, but!

It bothers me a lot that writing

Myconstructor(:Animator) putting a period after MyConstructor tells me “you can use methods” (but my methods are made only for “:” ". Is it even possible to fix it?

And I’m also not sure that I’ve typed everything correctly here. Tell me if I did something wrong

As far as i know, you can’t only make it autocomplete only when using colon notation. It should autocomplete for both dot and colon if you type annotate with self, like you are currently doing.

The only reason this works for Roblox instance methods is because they are written in C++, which Luau directly interacts with (you’ll get a warning if you don’t pass both the object and parameters in Roblox instance cases).

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.