Porting default classes with .d.ts

anyone know how to make _feces.feces into feces itself? This will cause error since the library exports the class by default instead of a table/namespace that indexes .feces (which doesn't exist)
--Compiled with roblox-ts v3.0.0
local TS = _G[script]
local _feces = TS.import(script, script.Parent, "feces")
local feces = _feces.feces
local group = _feces.group
feces.new()
group(1, 1)
return nil
--Compiled with roblox-ts v3.0.0
local TS = _G[script]
local _feces = TS.import(script, script.Parent, "feces")
local feces = _feces.feces
local group = _feces.group
feces.new()
group(1, 1)
return nil
import { feces, group } from "./feces";

new feces();

group(1 as any, 1 as any);
import { feces, group } from "./feces";

new feces();

group(1 as any, 1 as any);
export function group(
changes: changes,
deletes?: deletes,
): Map<Player, applyable>;

export declare class feces {
replicated: Entity;
queries: {
single: Query<[unknown]>;
pair: Query<[unknown]>;
};
...
}
export function group(
changes: changes,
deletes?: deletes,
): Map<Player, applyable>;

export declare class feces {
replicated: Entity;
queries: {
single: Query<[unknown]>;
pair: Query<[unknown]>;
};
...
}
12 Replies
wAD
wAD4w ago
what does the library returns look like
duck
duckOP4w ago
function lib.new(world: jecs.World): feces
--assume the user has already added observers to the world
local replicated = world:component()
world:set(replicated, jecs.Name, "replicated")
...

return self :: feces
end

return lib :: lib
function lib.new(world: jecs.World): feces
--assume the user has already added observers to the world
local replicated = world:component()
world:set(replicated, jecs.Name, "replicated")
...

return self :: feces
end

return lib :: lib
wAD
wAD4w ago
so, assuming it's the class where does the group export comes from
duck
duckOP4w ago
No description
duck
duckOP4w ago
No description
duck
duckOP4w ago
No description
wAD
wAD4w ago
that is soo weird i just recommend changing the library exports it mixes a class and an arbitary function i guess you could type that as a static method yeahh static method works i believe
duck
duckOP4w ago
I'll give it a try
wAD
wAD4w ago
one sec
declare class feces {
replicated: Entity;
queries: {
single: Query<[unknown]>;
pair: Query<[unknown]>;
};

static group(
changes: changes,
deletes?: deletes,
): Map<Player, applyable>;
}

export = feces;
declare class feces {
replicated: Entity;
queries: {
single: Query<[unknown]>;
pair: Query<[unknown]>;
};

static group(
changes: changes,
deletes?: deletes,
): Map<Player, applyable>;
}

export = feces;
should look something liek this
duck
duckOP4w ago
An export assignment cannot be used in a module with other exported elements.ts(2309)
duck
duckOP4w ago
No description
duck
duckOP4w ago
oh I have exported types

Did you find this page helpful?