> With the ‘unknown’ type available is there a good case for ‘any’ anymore?
Lets say you have some input json that you want to slightly modify to something else. How would you do this with unknown? I can't just blindly replace any with unknown. I'd get errors like this:
The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter, but here has type 'unknown'.ts(2407)
For example, how can I do this better?
Remember the input json could be pretty much anything. I don't have a spec other than I only care about things that end with __c.
You could say technically could be simply { "Unsubscribe__c": false } or even {} both of which are silly in my case because there is no key for me to identify who the person is but they are valid inputs.
Or the input could have a thousand key values and I only care about some of them. What should my object look like? How do I create a class that says everything that ends in "__c" is something I care about? I tried unknown. I tried Object. How do I fix this (and learn something so I fix all future code I write)?
Thank you. That gives me a red underline under ContactId and Email now. I think because input.Contact__c and input.ContactEmail__c are unknown. I think this is the right direction. What is my next step?
(property) Output.ContactId: string Type 'unknown' is not assignable to type 'string'.ts(2322) Output.ts(4, 5): The expected type comes from property 'ContactId' which is declared here on type 'Output'
if (input[prefCode] !== null) {
currentValue = input[prefCode].toString();
}
in the lines above, I see a red underline under input[prefCode]
> Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'Object'.
No index signature with a parameter of type 'string' was found on type 'Object'.ts(7053)
Nice I tbink that is the answer! It is for when the way you need to deal with the data is so dynamic and runtime specified that crafting out the interface/types to cast to would be painful to impossible. Data wrangling.
What if there were a service where anyone can opt in to share their own location information? If there was a way to get across the hurdle of how does the service provider know if the person is indeed who they claim to be…
My thought is something like a phone number, email address, or domain name bypasses this problem. It is fairly trivial to verify you have access to a phone number, email address, domain name. Feels like this is one of those chicken and egg problems though. Why would anyone list their location at my service if nobody queries it and why would anyone query my service if nobody lists their information with me?
> It just turns out that delegating trust to root CAs, CAs, and browser/OS vendors (the latter via built-in certificate lists) makes it easy for the end user.
This flexibility is what allowed let’s encrypt to bootstrap, right?
Personally, I don’t mind giving them my phone number because my number is already public information. It sucks though that I can’t get tweets by text.
This was the original use case of twitter. I understand SMS is not secure enough to publish tweets but why can we no longer get texts when someone tweets?
I'm pretty sure you can still get SMS notifications by turning it on in your Settings[0] and then also clicking on the "Notifications" button on the specific profile for which you want to receive notifications. I haven't used it in ages but all the settings appear to be there still :)
No support for Android (yet). Install this Facebook container [1] on the desktop.
A request: I run Firefox nightly [2] as my main browser and would like to request everyone to consider using a pre-release version of Firefox if possible. It helps us make the argument that Mozilla should not run experiments in Firefox stable.
Been running nightly builds since I think 0.4 - makes web development ‘fun’ as you can never be sure if something works or not in a browser nightly build! Fortunately I don’t have to do that much any more.
I think he linked it so new readers can see the older comments and get clued in to the conversation. (:
I remember reading In the beginning was the command line back in high school. I liked the comparison with cars. I'm a little sad I never got to use the BeOS that the author so much likens to a batmobile (going from memory). This article even has its own Wikipedia article https://en.wikipedia.org/wiki/In_the_Beginning..._Was_the_Co...
For new readers, I'd also strongly recommend "Mother Earth Mother Board" by the same author, Neal Stephenson. In Mother Earth Mother Board, the author writes about the fiber optic cables that connect us across continents.
https://aka.ms/nohello
which redirects(?) to
https://sbmueller.github.io/nohello/