Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 22:12
    sheetalkamat edited #51769
  • 22:08
    sheetalkamat review_requested #51769
  • 22:08
    sheetalkamat review_requested #51769
  • 22:08
    sheetalkamat review_requested #51769
  • 22:08
    sheetalkamat review_requested #51769
  • 22:08
    typescript-bot labeled #51769
  • 22:08
    typescript-bot labeled #51769
  • 22:08
    typescript-bot assigned #51769
  • 22:08
    sheetalkamat opened #51769
  • 22:07

    sheetalkamat on getSupportedCodeFixes

    Make getSupportedCodeFixes on L… (compare)

  • 22:01
    doxxx closed #51768
  • 21:40
    jakebailey closed #51451
  • 21:38
    doxxx edited #51768
  • 21:38
    doxxx edited #51768
  • 21:36
    doxxx edited #51768
  • 21:36
    doxxx edited #51768
  • 21:34
    doxxx edited #51768
  • 21:30
    RyanCavanaugh labeled #51667
  • 21:30
    RyanCavanaugh milestoned #51667
  • 21:30
    RyanCavanaugh labeled #51667
bitonic 🍥
@bitonic:matrix.org
[m]
@scorgn: @fatcerberus thanks to both
Georgios Mavropalias
@georgios:matrix.org
[m]
@room hi everyone, I am looking for 1-2 people to become moderators in this room to remove spam. Anyone who is regularly active in this room and would like to help? thanks
0xAFFE
@tim:schumacher.im
[m]
Georgios Mavropalias: I had this room as a much more traffic intensive room in my headspace, but for this looks a lot more manageable, and I will participate more.
1 reply
Azat S.
@azat-io
Screenshot 2022-08-24 at 3.13.24 PM.png

Hi there!

Could you help. Typescript does not find imports when I use "moduleResolution": "nodenext", with "type": "module", (I need it)

I have created a repository where you can reproduce the issue by running npm run test: https://github.com/azat-io/typescript-nodenext-module

2 replies
Bruce Pascoe
@fatcerberus

@azat-io You'd have better luck asking over on Discord.

btw this community is basically dead - please migrate to https://discord.gg/typescript

6 replies
@georgios:matrix.org who are you? this room is dead and has been dead for months, nobody is "active" here
2 replies
0xAFFE
@tim:schumacher.im
[m]
As I wrote earlier, this it too much traffic for me, and I'm glad we are at the level we are right now. You don't need a high traffic channel to be successful. What really matters, that those who seek answers, will be answered and that happened the few days I would say.
Jordan Brant Baker
@hexsprite
How can I use a spread expression to call a function without error when the type is a union of either 2 or 3 elements.... I would assume it should work since the 3rd argument is optional... example here https://www.typescriptlang.org/play?ts=4.7.4&q=49#code/C4TwDgpgBAlgblAvFA2gOwK4FsBGEBOANFJrgcaXvgLpQA+ql5J2V1AUOwMYA2AhgGcBUAJJpgBOHx5QA3uyiKoXAPZoBwfBi7AV+ABQAPAFwsyRKCFNMLALwD8pvmhABKOQqWr1KnhAB0PCoA5kbEIMS2rp6KAL7s8ex+wFAIyCgoAIzEAEzUxFm5xADM1BzsaBAA7qLiktL6-k1wKAAM1NFAA
Shanon Jackson
@ShanonJackson

Wonder if there's a way to "simplify" a type "programmatically"

I.E
You have a very large type that you run through alot of processing, changing keys, changing values, etc.
Then I want to take that type say "A" and output the processed type to a new file "generated.ts"

(typescript compiler)
0xAFFE
@tim:schumacher.im
[m]
There are some tools to manipulate the AST for typescript files
I once played with https://github.com/dsherret/ts-morph/tree/latest/packages/ts-morph and it went pretty well
[pihentagy]
@pihentagy:matrix.org
[m]
Typescript itself has tools to manipulate ast. It's in the official docs (by MS)
hinell
@hinell
BruceGitHub
@BruceGitHub
Hi guys
it's possible to instruct typescript / vscode to read the definition type for one file?
hello.js > hello.d.ts
this works for the file that uses the function inside a hello.js but doesn't work for hello.js itself
...
In my case only a compile-time to have a check types but not in the build, because this file currently is run with node without ts (the hello.js)
BruceGitHub
@BruceGitHub
BruceGitHub
@BruceGitHub
but this approach creates duplicate definitions :-(
BruceGitHub
@BruceGitHub
Bruce Pascoe
@fatcerberus
no, .d.ts isn't a header file
it's only for consumers of your code
Jacob Madsen
@jacobmadsen
Anyone know how to use TSDoc to describe a function param where the param's type is a union of string literals. Something like isnt working:
/**
 * Where Query
 *
 * @param key name
 * @param {'='} operator equal
 * @param {'!='} operator not equal
 * @param param parameter
 */
function where(key: string, operator: '=' | '!=', param: unknown): void {}
hinell
@hinell
I've created an issue in #vscode repo to dissucss whether we should have a separate language support for #zsh scripts or not. Please checkout:
microsoft/vscode#164985
tmerse
@tmerse:matrix.org
[m]
Can anyone tell me, what I need to do in order for this to be typed properly?
property test of interface FM should be an array consisting of two values: first the key of property of SomeInterface. The second value inside the array should be the respective value.
Erol
@FrEaKmAn

hi all.. if I have following function,

function foo() {

}

foo.extra = function() {}

how can I define typings for this?

2 replies
Jacob Bogers
@Jacob_Bogers_twitter
Hi
I am having a problem with typescript paths, i do things like `import { something } from '@path123/file' how can i make it that it appens a ".js" at the end (I want to using esm modules)
1 reply
Bruce Pascoe
@fatcerberus
not to be confused with https://flow.org/ I assume
Nikola Pavlovic
@raegen

so, I'm having a very amusing case:
TS 4.6.4

Type 'T | undefined' is not assignable to type 'T | T[] | undefined'

Nikola Pavlovic
@raegen
is this expected behaviour? How come?
Tom Enden
@tomenden
I'm having trouble extracting Parameters Union from a generic function. Seems like Parameters is not behaving as I expected it to, Playground - https://www.typescriptlang.org/play?#code/CYUwxgNghgTiAEAzArgOzAFwJYHtXzDigxABEQA3AUWCwxxgGEIsRUMAKASgC54BvAFDwR8PHyGip8DpTYY+AcloBnMHlTgSwRQBoCUCBABGUMAGs+3eAF4AfPAo4swXo+fAA3MOkjZFeSU4dVRNTBAdfTBDEzNLGS5bBycXNxSvHxEAX28cwUEMAE8ABwRyalp6JhZ5W3gAJRAMZBhUABUSkAAeItKcRAIiEnKaOgZmVnY7As74AHlUADE0TFx8G3gRyvGa9gBtRTxFAF18mdL4KgD2ADkoAFsQFTqABVgHppAYFS6F5fRsHg7HsAAynAD04PgoBUWDgwHgAFp4CAAB4YGBmDDwGLwYo4FSw4wQBByW4fFRKVQhMLaRTwAA+8EUwQ0WgiikEkJxmGQhiRl2uGDuj2eWGeeAghXgGAAFghoCpsXgEMiWeA2eEdPkgA
declare function createDevEditorClient(): {
    on: {
        (event: 'disconnected', callback: () => void): void;
        (event: 'reconnected', callback: () => void): void;
    };
};

type DevEditorClient = ReturnType<typeof createDevEditorClient>
type OnFunction = DevEditorClient['on']


type EventNames = Parameters<OnFunction>[0]
// desired - extract all possible eventNames: 'disconnected' | 'reconnected'
// actual - EventNames is only the last one - 'reconnected'
5 replies
cphoover
@cphoover

Does anyone have experience using node.js stream package with typescript?

Seems like typescript support is lacking ... e.g. Readable/Writeable from node.js do not have generics as part of their declaration for objectMode streams of a certain type...

Also... the compose function is not found in typescript

When I try and import { compose } from 'stream' I get

'Module stream has no exported member compose

Salathiel Genese
@SalathielGenese

Hi everyone,

Please I have typing issues for the last couple of lines.
(At first, I thought my IDE was trying to me smart, but I just reproduced it on TypeScript official playground)

The question is how to fix?

type Capture<T> = string | symbol & Record<never, T>;
type Target<C> = C extends Capture<infer T> ? T : never;
declare function resolve<C extends Capture<any>>(key: C): Target<C>;
declare function resolve(key: string): unknown;
declare function resolve(key: number): never;

let valueTypeNever = resolve(0); // never: OK
let valueTypeUnknown = resolve(''); // unknown: OK
let shouldBeValueTypeNumber = resolve('' as Capture<number>); // unknown: KO
let shouldBeValueTypeString = resolve(Symbol('') as Capture<string>); // unknown: KO
[pihentagy]
@pihentagy:matrix.org
[m]
Not clear to me what resolve tries to achieve.
Wild guess: try specifying the type parameter by hand. as is evil.
resolve<MyType>(whatever) instead of resolve(whatever as SomeType)
Btw seems you are trying some type juggling. Have you heard about zod?
Salathiel Genese
@SalathielGenese

Not clear to me what resolve tries to achieve.

The implementation? IoC

IoC/DI type inference, to be accurate.

Salathiel Genese
@SalathielGenese
Christopher Thomas
@christhomas
Is there any way to define interfaces for my entire app without having to import everything manually all the time?
Salathiel Genese
@SalathielGenese

:point_up: December 4, 2022 3:31 PM

tsconfig.json compilerOptions.types will auto-import typings.

[pihentagy]
@pihentagy:matrix.org
[m]
Because list needs the property c.
Maybe you meant property z in line 4.
BruceGitHub
@BruceGitHub
But 'c' is in the computes property
[foo.hello] // 'c'