Alejandro Mery
Alejandro Mery
Explore posts from servers
NNuxt
Created by Alejandro Mery on 5/6/2024 in #❓・help
create stricter type
thank you, I recently cancelled my discord subscription and not I'm being told I can't join more servers 😭 frustratingly it doesn't tell me how many I need to leave 😕 I may just create another account 😅
27 replies
NNuxt
Created by Alejandro Mery on 5/6/2024 in #❓・help
create stricter type
thank you!
27 replies
NNuxt
Created by Alejandro Mery on 5/6/2024 in #❓・help
create stricter type
It's not a blocker indeed, mostly curiosity. but I am a strong-typed systems developer (C,Go) moving out of my comfort zone a bit trying to learn from vue/nuxt devs how to make front-end stuff "the right way" 🤷‍♂️
27 replies
NNuxt
Created by Alejandro Mery on 5/6/2024 in #❓・help
create stricter type
any recommended discord server focused on typescript? it's quite annoying the discussion channels got closed here
27 replies
NNuxt
Created by Alejandro Mery on 5/6/2024 in #❓・help
create stricter type
27 replies
NNuxt
Created by Alejandro Mery on 5/6/2024 in #❓・help
create stricter type
27 replies
NNuxt
Created by Alejandro Mery on 5/6/2024 in #❓・help
create stricter type
my other use-case composes keys based on the keys of one of the arguments
27 replies
NNuxt
Created by Alejandro Mery on 5/6/2024 in #❓・help
create stricter type
even being pretty static I just can't make a keys type
27 replies
NNuxt
Created by Alejandro Mery on 5/6/2024 in #❓・help
create stricter type
e.g.
export type standardDynamicSchemeFactory = (primary: HexColor | Hct | number, isDark: boolean, contrastLevel: number) => DynamicScheme;

export const standardDynamicSchemes: Record<string, standardDynamicSchemeFactory> = {
content: (primary, isDark = false, contrastLevel = 0) => new SchemeContent(hct(primary), isDark, contrastLevel),
expressive: (primary, isDark = false, contrastLevel = 0) => new SchemeExpressive(hct(primary), isDark, contrastLevel),
fidelity: (primary, isDark = false, contrastLevel = 0) => new SchemeFidelity(hct(primary), isDark, contrastLevel),
monochrome: (primary, isDark = false, contrastLevel = 0) => new SchemeMonochrome(hct(primary), isDark, contrastLevel),
neutral: (primary, isDark = false, contrastLevel = 0) => new SchemeNeutral(hct(primary), isDark, contrastLevel),
tonalSpot: (primary, isDark = false, contrastLevel = 0) => new SchemeTonalSpot(hct(primary), isDark, contrastLevel),
vibrant: (primary, isDark = false, contrastLevel = 0) => new SchemeVibrant(hct(primary), isDark, contrastLevel),
};

export type standardDynamicSchemeKey =
'content' | 'expressive' | 'fidelity' |
'monochrome' | 'neutral' | 'tonalSpot' | 'vibrant';
export type standardDynamicSchemeFactory = (primary: HexColor | Hct | number, isDark: boolean, contrastLevel: number) => DynamicScheme;

export const standardDynamicSchemes: Record<string, standardDynamicSchemeFactory> = {
content: (primary, isDark = false, contrastLevel = 0) => new SchemeContent(hct(primary), isDark, contrastLevel),
expressive: (primary, isDark = false, contrastLevel = 0) => new SchemeExpressive(hct(primary), isDark, contrastLevel),
fidelity: (primary, isDark = false, contrastLevel = 0) => new SchemeFidelity(hct(primary), isDark, contrastLevel),
monochrome: (primary, isDark = false, contrastLevel = 0) => new SchemeMonochrome(hct(primary), isDark, contrastLevel),
neutral: (primary, isDark = false, contrastLevel = 0) => new SchemeNeutral(hct(primary), isDark, contrastLevel),
tonalSpot: (primary, isDark = false, contrastLevel = 0) => new SchemeTonalSpot(hct(primary), isDark, contrastLevel),
vibrant: (primary, isDark = false, contrastLevel = 0) => new SchemeVibrant(hct(primary), isDark, contrastLevel),
};

export type standardDynamicSchemeKey =
'content' | 'expressive' | 'fidelity' |
'monochrome' | 'neutral' | 'tonalSpot' | 'vibrant';
27 replies
NNuxt
Created by Alejandro Mery on 5/6/2024 in #❓・help
create stricter type
either { [x:string]: Foo } or Record<string,Foo>
27 replies
NNuxt
Created by Alejandro Mery on 5/6/2024 in #❓・help
create stricter type
I want to programmatically add fields to the object and then turn it into a strict type but as soon as I give a type to the target object it sticks permanently
27 replies
NNuxt
Created by Alejandro Mery on 5/6/2024 in #❓・help
create stricter type
nope, keyof typeof table gives string | number instead of the list of keys
27 replies
NNuxt
Created by Alejandro Mery on 4/13/2024 in #❓・help
type checking custom AppConfig entries
thanks again. I'm closing this now 🙏
40 replies
NNuxt
Created by Alejandro Mery on 4/13/2024 in #❓・help
type checking custom AppConfig entries
my fault, it caught a previous typo and didn't continue checking
40 replies
NNuxt
Created by Alejandro Mery on 4/13/2024 in #❓・help
type checking custom AppConfig entries
I just noticed checking doesn't work on the LAST entry. is this the weird behaviour you mentioned?
40 replies
NNuxt
Created by Alejandro Mery on 4/13/2024 in #❓・help
type checking custom AppConfig entries
thank you so much @pyplacca
40 replies
NNuxt
Created by Alejandro Mery on 4/13/2024 in #❓・help
type checking custom AppConfig entries
the @!!!!
40 replies
NNuxt
Created by Alejandro Mery on 4/13/2024 in #❓・help
type checking custom AppConfig entries
app.config.ts still thinks myThing.something is boolean, ignoring the type 😭
40 replies
NNuxt
Created by Alejandro Mery on 4/13/2024 in #❓・help
type checking custom AppConfig entries
like this? @pyplacca
diff --git a/web/client/src/index.d.ts b/web/client/src/index.d.ts
index c9aef34..dbac142 100644
--- a/web/client/src/index.d.ts
+++ b/web/client/src/index.d.ts
@@ -1,9 +1,7 @@
-import type { myThingAppConfig } from './types';
+export {};

declare module 'nuxt/schema' {
- interface AppConfig {
+ interface AppConfigInput {
myThing?: myThingAppConfig
}
}
-
-export {}
diff --git a/web/client/src/index.d.ts b/web/client/src/index.d.ts
index c9aef34..dbac142 100644
--- a/web/client/src/index.d.ts
+++ b/web/client/src/index.d.ts
@@ -1,9 +1,7 @@
-import type { myThingAppConfig } from './types';
+export {};

declare module 'nuxt/schema' {
- interface AppConfig {
+ interface AppConfigInput {
myThing?: myThingAppConfig
}
}
-
-export {}
40 replies
NNuxt
Created by Alejandro Mery on 4/13/2024 in #❓・help
type checking custom AppConfig entries
I was using AppConfigInput initially 😭 where did you place the file? root or srcDir?
40 replies