IntelliSense autocomplete not showing up exclusively for Sapphire classes?

When trying to extend Command class, as well as other classes like Listener, IntelliSense autocomplete seems not to work in the class definition? Originally, when pressing CTRL + SPACE should show the extended class methods & properties, but it doesn't seems to do so.
No description
Solution:
FIX MERGED 🎉
No description
Jump to solution
75 Replies
Sandy Stone
Sandy StoneOP6mo ago
But when doing it with other normal classes, it seems to work perfectly fine.
No description
Sandy Stone
Sandy StoneOP6mo ago
I'm wondering if this is just me or it also happens to others? If it's me, might be an issue with my tsconfig.json, so here it is just in case:
{
"compilerOptions": {
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"exactOptionalPropertyTypes": true,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noPropertyAccessFromIndexSignature": true,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"strict": true,
"useUnknownInCatchVariables": true,
"module": "node16",
"moduleResolution": "node16",
"resolveJsonModule": true,
"newLine": "lf",
"outDir": "./out/",
"sourceMap": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es2022",
"skipLibCheck": true
},
"include": ["./src/**/*"]
}
{
"compilerOptions": {
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"exactOptionalPropertyTypes": true,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noPropertyAccessFromIndexSignature": true,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"strict": true,
"useUnknownInCatchVariables": true,
"module": "node16",
"moduleResolution": "node16",
"resolveJsonModule": true,
"newLine": "lf",
"outDir": "./out/",
"sourceMap": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es2022",
"skipLibCheck": true
},
"include": ["./src/**/*"]
}
Sandy Stone
Sandy StoneOP6mo ago
Only seems to work in JS?
No description
Favna
Favna6mo ago
Not sure why this happens but I doubt there is much we can do abouut it. We provide the typings files and they're perfectly valid files. This is on TS server not providing the hints. Anyway I'll ping @vladdy and @kyra 🩵🩷🤍🩷🩵 in here see if they have any thoughts
Sandy Stone
Sandy StoneOP6mo ago
Alright, thanks a lot. I might end up making an issue on TypeScript repository if it's really something TS-related
Favna
Favna6mo ago
Okay I found what causes it actually but this is definitely a TS issue if you remove the type arguments from the class then it does work so in the typings file change
declare class Command<PreParseReturn = Args, Options extends Command.Options = Command.Options> extends AliasPiece<Options, 'commands'> {
declare class Command<PreParseReturn = Args, Options extends Command.Options = Command.Options> extends AliasPiece<Options, 'commands'> {
to
declare class Command {
declare class Command {
Naturally you cant actually do this because it will break a lot, but you can use that when creating your report to TS
Sandy Stone
Sandy StoneOP6mo ago
Interesting, will for sure include it on the issue
Favna
Favna6mo ago
screenshots that shows that
No description
No description
Favna
Favna6mo ago
what I find interesting is that both of these do work
No description
No description
Favna
Favna6mo ago
oh wait it's not the generic type, it's the extend AliasPiece but why.. hm weird I cannot reproduce it in test classes well something funky is happening anyway
Sandy Stone
Sandy StoneOP6mo ago
Yepp
Favna
Favna6mo ago
might be best to link them a tiny sapphire repro repo with just a single command file and such
Favna
Favna6mo ago
I thought maybe this would repro it but no
No description
vladdy
vladdy6mo ago
Maybe its something to do with declare
Sandy Stone
Sandy StoneOP6mo ago
Does it working on JavaScript and not in TypeScript means something important?
Favna
Favna6mo ago
not sure.. even this code which mimicks Sapphire's entire extension stack doesnt repro the issue
interface Opts {
foo: 'bar';
baz: 'qux';
}

interface ExtendedOpts extends Opts {
readonly aliases?: readonly string[];
}

interface UnrelatedOpts {
unrelated: 'value';
}

interface StrategyOpts {
strategy: 'value';
}

interface FinalOpts extends ExtendedOpts, StrategyOpts {
final: 'value';
}

type Keys = keyof Opts;

class BaseClass<T extends Opts = Opts, K extends Keys = Keys> {
public constructor(public readonly value: T) {}

public myMethod() {
return this.value;
}
}

class ExtendedClass<T extends ExtendedOpts = ExtendedOpts, K extends Keys = Keys> extends BaseClass<T, K> {
public myOtherValue: string = 'test';
public constructor() {
super('foo' as any); // Ignore this error
}
}

class FinalClass<U = UnrelatedOpts, T extends FinalOpts = FinalOpts> extends ExtendedClass<T, 'baz'> {

}
interface Opts {
foo: 'bar';
baz: 'qux';
}

interface ExtendedOpts extends Opts {
readonly aliases?: readonly string[];
}

interface UnrelatedOpts {
unrelated: 'value';
}

interface StrategyOpts {
strategy: 'value';
}

interface FinalOpts extends ExtendedOpts, StrategyOpts {
final: 'value';
}

type Keys = keyof Opts;

class BaseClass<T extends Opts = Opts, K extends Keys = Keys> {
public constructor(public readonly value: T) {}

public myMethod() {
return this.value;
}
}

class ExtendedClass<T extends ExtendedOpts = ExtendedOpts, K extends Keys = Keys> extends BaseClass<T, K> {
public myOtherValue: string = 'test';
public constructor() {
super('foo' as any); // Ignore this error
}
}

class FinalClass<U = UnrelatedOpts, T extends FinalOpts = FinalOpts> extends ExtendedClass<T, 'baz'> {

}
BaseClass = Piece ExtendedClass = AliasPiece FinalClass = Command tried addng declares to the code above and still works
vladdy
vladdy6mo ago
Wtf
Favna
Favna6mo ago
also added namespaces, still cnr
interface Opts {
foo: 'bar';
baz: 'qux';
}

interface ExtendedOpts extends BaseClass.OOpts {
readonly aliases?: readonly string[];
}

interface UnrelatedOpts {
unrelated: 'value';
}

interface StrategyOpts {
strategy: 'value';
}

interface FinalOpts extends ExtendedClass.TTOpts, StrategyOpts {
final: 'value';
}

type Keys = keyof Opts;

declare class BaseClass<T extends Opts = Opts, K extends Keys = Keys> {
public readonly value: T;
public myMethod(): T;
}

declare namespace BaseClass {
type OOpts = Opts;
type KKeys = Keys;
}

declare class ExtendedClass<T extends ExtendedOpts = ExtendedOpts, K extends BaseClass.KKeys = BaseClass.KKeys> extends BaseClass<T, K> {
public myOtherValue: string;
}

declare namespace ExtendedClass {
type TTOpts = ExtendedOpts;
type KKKeys = BaseClass.KKeys;
}

class FinalClass<U = UnrelatedOpts, T extends FinalOpts = FinalOpts> extends ExtendedClass<T, 'baz'> {

}
interface Opts {
foo: 'bar';
baz: 'qux';
}

interface ExtendedOpts extends BaseClass.OOpts {
readonly aliases?: readonly string[];
}

interface UnrelatedOpts {
unrelated: 'value';
}

interface StrategyOpts {
strategy: 'value';
}

interface FinalOpts extends ExtendedClass.TTOpts, StrategyOpts {
final: 'value';
}

type Keys = keyof Opts;

declare class BaseClass<T extends Opts = Opts, K extends Keys = Keys> {
public readonly value: T;
public myMethod(): T;
}

declare namespace BaseClass {
type OOpts = Opts;
type KKeys = Keys;
}

declare class ExtendedClass<T extends ExtendedOpts = ExtendedOpts, K extends BaseClass.KKeys = BaseClass.KKeys> extends BaseClass<T, K> {
public myOtherValue: string;
}

declare namespace ExtendedClass {
type TTOpts = ExtendedOpts;
type KKKeys = BaseClass.KKeys;
}

class FinalClass<U = UnrelatedOpts, T extends FinalOpts = FinalOpts> extends ExtendedClass<T, 'baz'> {

}
Sandy Stone
Sandy StoneOP6mo ago
well uh...
Sandy Stone
Sandy StoneOP6mo ago
No description
Sandy Stone
Sandy StoneOP6mo ago
seems to be working pretty fine with typescript playground 💀
Sandy Stone
Sandy StoneOP6mo ago
real weird
vladdy
vladdy6mo ago
Then maybe its a vscode issue
Sandy Stone
Sandy StoneOP6mo ago
yupp, probabl
Sandy Stone
Sandy StoneOP6mo ago
@Boomeravna @vladdy Removing this in the Piece class seems to fix it:
No description
Sandy Stone
Sandy StoneOP6mo ago
No description
vladdy
vladdy6mo ago
h u h
Sandy Stone
Sandy StoneOP6mo ago
exactly 💀
vladdy
vladdy6mo ago
why does the container break it
Sandy Stone
Sandy StoneOP6mo ago
this is giving me headache apparently if i change the type to like a string, seems to fix it too
Sandy Stone
Sandy StoneOP6mo ago
No description
vladdy
vladdy6mo ago
what happens if the getter is moved from piece to command?
Sandy Stone
Sandy StoneOP6mo ago
seems to work too found another useful thing too
vladdy
vladdy6mo ago
????
Sandy Stone
Sandy StoneOP6mo ago
renaming the interface "Container" to another name fixs it
vladdy
vladdy6mo ago
H U H
Sandy Stone
Sandy StoneOP6mo ago
No description
No description
No description
Sandy Stone
Sandy StoneOP6mo ago
LOL
vladdy
vladdy6mo ago
PARDON MY WHAT
Sandy Stone
Sandy StoneOP6mo ago
is like Container an already defined object or something? 😭
vladdy
vladdy6mo ago
ohhh dom types maybe? but i dont think it is
Sandy Stone
Sandy StoneOP6mo ago
could be, let me try something i removed the interface of Container and CTRL + CLICK the "Container" in the container get accessor of the Piece class redirected me to this
Sandy Stone
Sandy StoneOP6mo ago
No description
Sandy Stone
Sandy StoneOP6mo ago
reverting everything and removing this Container interface seems to fix it
vladdy
vladdy6mo ago
so module augmentation breaks it oof.
Sandy Stone
Sandy StoneOP6mo ago
it seems so 😭
vladdy
vladdy6mo ago
that sounds like a ts issue then but idk how to report that
Sandy Stone
Sandy StoneOP6mo ago
imma try reporting it even though will be my first time doing so, but first i'll see if i can find any existing report anywhere
Favna
Favna6mo ago
Either way, thank you very much for doing so much investigation @Sandy Stone. It's extremely valueable.
Sandy Stone
Sandy StoneOP6mo ago
it's everything alright 💓 i want to have the best experience using this framework, and if i can find anything to do in order to make it even more awesome, i'm willing to do it not just for me, but for anyone else found this pretty useful log in tsserver
Sandy Stone
Sandy StoneOP6mo ago
No description
Sandy Stone
Sandy StoneOP6mo ago
it's definitely vscode tsserver related issues are either closed or missing information https://github.com/microsoft/vscode/issues/115605 https://github.com/microsoft/vscode/issues/115435 https://github.com/microsoft/TypeScript/issues/37759 https://github.com/microsoft/TypeScript/issues/37358 will make the issue to see what they say i will first put it on typescript repository and not in vscode because
Sandy Stone
Sandy StoneOP6mo ago
vscode repository issues are... the image is self explanatory
No description
Sandy Stone
Sandy StoneOP6mo ago
alright, made it, hopefully explained enough to get an useful reply 😭🙏
Sandy Stone
Sandy StoneOP6mo ago
GitHub
Module augmentation seems to break entirely a class definition/body...
🔎 Search Terms "debug failure completionInfo", "module augmentation breaks autocomplete classes" 🕗 Version & Regression Information This is the behavior in every version I t...
Sandy Stone
Sandy StoneOP6mo ago
@vladdy @Boomeravna btw if any of you could take a look at the "Additional information about the issue" section to see if i'm right about what i said about the sapphire package, as i got no idea how the framework works behind the scenes, will appreciate it 🙏
Favna
Favna6mo ago
LGTM
Sandy Stone
Sandy StoneOP6mo ago
pefecto added to typescript 5.6.0 milestone 👏
vladdy
vladdy6mo ago
Wouldn't be the first time I've had a debug failed while using ts and sapphire Lets hope its an ez fix
Sandy Stone
Sandy StoneOP6mo ago
hopefully 🙏
MRDGH2821
MRDGH28216mo ago
So this why it wasn't working (in my computer) all this time 🤯
Sandy Stone
Sandy StoneOP6mo ago
in everyones it seems 😭
Sandy Stone
Sandy StoneOP6mo ago
No description
Sandy Stone
Sandy StoneOP6mo ago
pull request created, fixes the issue i believe
Favna
Favna6mo ago
awesome!!
Sandy Stone
Sandy StoneOP4mo ago
delayed 😔
No description
Sandy Stone
Sandy StoneOP4mo ago
i think it's still coming to typescript 5.6.0 though, which would be in september 3rd
No description
MRDGH2821
MRDGH28214mo ago
:dead:
Solution
Sandy Stone
Sandy Stone4mo ago
FIX MERGED 🎉
No description
Sandy Stone
Sandy StoneOP4mo ago
should be available now in typescript@next nvm it's not. idk how this repository works, but atleast it's merged now
Sandy Stone
Sandy StoneOP4mo ago
could be available tomorrow though? idk
No description
Sandy Stone
Sandy StoneOP4mo ago
yeah it should be available tomorrow as @next releases seem to be published at midnight for each day, and this pull request was recently merged
No description
Favna
Favna4mo ago
super cool
Favna
Favna4mo ago
I'd say that one can finally be marked as the answer lol
Want results from more Discord servers?
Add your server