Even in TypeScript, `never` (the type of functions that never return - throwing ≠ returning) is the subtype of *all* types, even primitives. -----
Isiah Meadows [email protected] Looking for web consulting? Or a new website? Send me an email and we can get started. www.isiahmeadows.com On Sun, Mar 25, 2018 at 7:45 PM, dante federici <[email protected]> wrote: > Not a bad idea -- I agree that it really belongs here, but its value is much > higher in something like TypeScript, where you can keep the typing signature > but have a missing implementation. > > > On Sat, Mar 24, 2018 at 3:32 AM Isiah Meadows <[email protected]> > wrote: >> >> I would suggest, if you have support in your editor, just making a >> `???` snippet expand to `throw new Error("unimplemented")`. I've been >> doing similar (mod the snippet) for a while, and it's worked pretty >> well. >> ----- >> >> Isiah Meadows >> [email protected] >> >> Looking for web consulting? Or a new website? >> Send me an email and we can get started. >> www.isiahmeadows.com >> >> >> On Fri, Mar 23, 2018 at 11:16 AM, dante federici >> <[email protected]> wrote: >> > Simple example (ts): >> > ```typescript >> > interface SearchFunc { >> > (source: string, subString: string): boolean; >> > } >> > >> > // Later >> > let mySearch: SearchFunc; >> > mySearch = function(source: string, subString: string) { ??? } >> > ``` >> > >> > Simple example (js): >> > ```js >> > class MyClass = { >> > foo() { return "foo"; } >> > bar() { return "bar"; } >> > } >> > class ExtendClass extends MyClass { >> > foo(){ ??? } >> > bar(){ return `extended bar`; } >> > } >> > >> > // Elsewhere >> > myRunner = (classInstance) => `${classInstance.foo()} :: >> > ${classInstance.bar()}`; >> > >> > myRunner(myClassInstance); >> > myRunner(extendedClassInstance); >> > ``` >> > >> > Decorations would be good for classes, but don't work for regular >> > methods. >> > >> > I'm not sold we need new syntax for this -- I just find myself reaching >> > for >> > the `???` symbol. Especially in a typed language or in any instance that >> > we >> > have a class and extended paradigm, or when you have a prescribed >> > "object" >> > shape. >> > >> > _______________________________________________ >> > es-discuss mailing list >> > [email protected] >> > https://mail.mozilla.org/listinfo/es-discuss >> > > > > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss > _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

