!xfqwqigUlAuUTEIPwA:matrix.org

TypeScript

934 Members
A superset of JavaScript that compiles to clean JavaScript output. https://www.typescriptlang.org/24 Servers

Load older messages


Timestamp Message
9 Apr 2020
23:43:12@gitter_dgreensp:matrix.orgDavid Greenspan (Gitter) It also raises the question, if TypeScript tracks "properties and their narrow types in the current scope," why can't it populate this information when you assign an object literal to a variable, as in (1) and (4)
10 Apr 2020
00:20:07@gitter_keithlayne:matrix.orgKeith Layne (Gitter)

this is fun:

const f: Foo = {}
f.x = 'hello';
(() => { console.log(f.x.trim()) })(); // works
const g = () => { console.log(f.x.trim()) }; // breaks

I know that TS special-cases IIFEs so that probably isn't surprising, but I only know that from hints and rumors around here. Probably in some github issue, but still. Your example sruprises me too, I've never noticed that.

00:20:53@gitter_keithlayne:matrix.orgKeith Layne (Gitter) but it kinda reminds me of how let works.
01:24:39@gitter_dgreensp:matrix.orgDavid Greenspan (Gitter)ha, interesting :) the body of the IIFE is considered to be in the same scope, for analysis purposes, or something like that :)
02:03:52@gitter_keithlayne:matrix.orgKeith Layne (Gitter) yeah in general CFA doesn't cross function boundaries, if that makes sense. Pretty sure you know what I'm talking about. I just didn't know that they special-cased that until somebody here told me IIRC.
02:53:28@gitter_tietyt:matrix.orgtieTYT (Gitter)is there a way to check the length of the tupple?
02:54:34@gitter_tietyt:matrix.orgtieTYT (Gitter) nevermind, I get what's going on
02:55:21@gitter_keithlayne:matrix.orgKeith Layne (Gitter) @Gerrit0 why you crushing hopes and dreams in discord?
03:04:32@gitter_fatcerberus:matrix.orgBruce Pascoe (Gitter) @dgreensp IIFEs preserve narrowing because the compiler knows without looking at anything else that it will be executed immediately. In general however, CFA doesn't cross function boundaries. See #9998
03:06:48@gitter_keithlayne:matrix.orgKeith Layne (Gitter)

yeah in general CFA doesn't cross function boundaries,

bro you always be saying what I'm saying.

03:06:59@gitter_keithlayne:matrix.orgKeith Layne (Gitter)Just usually more eloquently :trolleybus:
03:08:10@gitter_fatcerberus:matrix.orgBruce Pascoe (Gitter) But yeah as for CFA rules being documented... probably not. There's a lot of really inconsistent stuff like that and since the specification hasn't been updated in years--with seemingly no intention of updating it ever again--we just have to deal with the idiosyncrasies
03:08:49@gitter_keithlayne:matrix.orgKeith Layne (Gitter) I think Orta said he pushed to remove that, but for some reason they haven't
03:19:19@gitter_keithlayne:matrix.orgKeith Layne (Gitter) I think you're on mobile and not reloading every minute and missing out on my classy trolling.
08:25:29@gitter_goutamdh:matrix.orgGoutam (Gitter) Hi How will I package my typescript for js and typescript , I want don't want use any package manager
08:26:48@gitter_goutamdh:matrix.orgGoutam (Gitter) please help me . i search but i didn't get any good article about that
09:11:19@d2s:matrix.org@d2s:matrix.org left the room.
11:32:53@gitter_jooola:matrix.orgJonas L. (Gitter) joined the room.
11:32:54@gitter_jooola:matrix.orgJonas L. (Gitter) Hello folks, I'm struggling with type inference of async generator, how can I type hint a generator in typescript ? I have a dumb walk function that return a filepath (string) and file stats (fs.Stats), but I cannot find any way to specify the yield type without casting to a interface (for value of generator() as valueType[])
11:32:56@gitter_jooola:matrix.orgJonas L. (Gitter)Does anyone have an example somewhere ?
11:33:19@gitter_jooola:matrix.orgJonas L. (Gitter) (edited) Does anyone have an example somewhere ? => Hello folks, I'm struggling with type inference of async generator, how can I type hint a generator in typescript ? I have a dumb walk function that yield a filepath (string) and file stats (fs.Stats), but I cannot find any way to specify the yield type without casting to a interface (for value of generator() as valueType[])
11:33:43@gitter_jooola:matrix.orgJonas L. (Gitter) (edited) ... to a interface ... => ... to an interface ...
13:05:51@gitter_fatcerberus:matrix.orgBruce Pascoe (Gitter) TS should be able to infer the yield type if you can yield different things
https://www.typescriptlang.org/play/?ssl=1&ssc=1&pln=7&pc=1#code/GYVwdgxgLglg9mAVAAmHOAKAlMg3gKGSORmGQwFkBDKACwDoAnKsAEzgFttkAeZABnoBWLIWLiAnjACmAG1bIA7MoDcYonIDO09eORS5CgEQRa6ZKfRG1AX3xA
13:07:57@gitter_fatcerberus:matrix.orgBruce Pascoe (Gitter) You can annotate it if you want though, just specify the return type as either Iterable<YieldType> or if you need more control use the Generator<> type
13:18:25@gitter_fatcerberus:matrix.orgBruce Pascoe (Gitter) For async generators use AsyncIterableIterator instead
13:18:38@gitter_osnysantos:matrix.orgOsny Netto (Gitter) joined the room.
13:18:39@gitter_osnysantos:matrix.orgOsny Netto (Gitter) hey folks, still struggling a lot with TS, can someone help me here? this code is using jQuery https://share.getcloudapp.com/YEu1GjkO
13:22:31@gitter_fatcerberus:matrix.orgBruce Pascoe (Gitter) (edited) ... use `AsyncIterableIterator` instead => ... use `AsyncIterator` and `AsyncGenerator` instead
13:23:35@gitter_fatcerberus:matrix.orgBruce Pascoe (Gitter) (edited) ... use `AsyncIterator` and ... => ... use `AsyncIterable` and ...
13:31:21@gitter_goutamdh:matrix.orgGoutam (Gitter)Hi floks ,can any help . How to make a local package of typescript and use in another project of typescript

There are no newer messages yet.


Back to Room List