How to resolve error "constructors in/after an Optional Chain are not allowed" - babeljs

I meet a problem when I'm integrating plugin #babel/plugin-proposal-optional-chaining, and it throws error like this:
constructors in/after an Optional Chain are not allowed.
How to resolve this problem? Thanks.

Related

How can solve the error in flutter_paystack?

Type mismatch: inferred type is Activity? but Activity was expected
Type mismatch: inferred type is BinaryMessenger? but BinaryMessenger was expected
I think this might be that the library is not yet optimized to support Flutter 3 which came out recently. Try to communicate with the devs on their github this error and they might be able to fix it
add this to your pubspec.yaml file, this will solve it for now.
flutter_paystack:
git:
url: https://github.com/definitelyme/flutter_paystack.git
ref: a4a33c3dd0a12f46d655a2e63d11e9f20ba82d01

Dart/Flutter linter rule: the type to index a map should be the key type of map?

For example, I have Map<int, int> m;. Then I can write down m['hello'] without any compile-time error, but of course, cannot find any element at runtime. I hope it will produce an error (or warning) at compile-time or lint time.
This is a big problem in many cases. For example, when I refactor Map<A, int> m into Map<B, int> m, I want to have compile-time errors for all accesses like m[some_var_of_type_A], instead of no compile-time errors and suddenly it explodes at runtime. As another example, the de-serialized JSON is of type Map<String, ...> but the key is actually a int. So it is tempting to do var userId=42; deserializedJson[userId] but only to find errors. Actually need to do deserializedJson[userId.toString()].
You know, dart's type system is so strong (even null safe!), and I really enjoy it since it catchs a LOT of bugs at compile-time. So I hope this problem can also be addressed at compile-time.
Thanks for any suggestions!
There currently is no lint to warn about doing lookups on a Map with arguments of the wrong type. This has been requested in https://github.com/dart-lang/linter/issues/1307.
Also see https://github.com/dart-lang/sdk/issues/37392, which requests a type-checked alternative to Map.operator []. In the meantime, Dart's extension mechanism allows anyone to easily add such an alternative themselves. For example, package:basics provides a type-checked Map.get extension.
NOTE:
The original answer was wrong and has been edited to:
point out the right/better answer
explain why the original answer was wrong
Thank you #jamesdlin for pointing this out.
Better answer
As pointed by #jamesdlin in his answer, the lint rule mentioned in the question has been requested in the flutter Github issues, and not in production yet.
Original Answer (wrong but kind of related to the question)
Why it is wrong:
The question was asking about the lint rule when using an index of Map. The answer however gave the lint rule about initializing a map using the wrong index (By the wrong index, I mean different data type).
Below is the answer:
There is a lint rule for this.
For example, if you define a Map like this ->
final Map<String, String> m = {
1: 'some random value',
};
It shows an error right away and this won't compile. This is the error ->
Error: A value of type 'int' can't be assigned to a variable of type 'String'.
1: 'error because index is of type String but assigned value is of type int',
^
Error: Compilation failed.
See the official docs where this lint rule, map_key_type_not_assignable is defined.
I have tested this in dartpad and vs code. Both IDEs show this error.
There could be some issues in your IDE configuration if you're not seeing this lint error.
As for your question, there is already a lint rule for this as explained above.

FIRAuth.auth() compiling error: "Cannot use optional chaining on non optional value 'FIRAuth'"

Cannot use optional chaining on non optional value 'FIRAuth'
I have tested every solutions, but always got the same error.
Even if i create a new project, when i'm using FIRAuth, i always got a compiling error.
Can someone help me please. I use Swift 2, Xcode 7, IOS9
If you are trying to add FIRAuth.auth()? try to remove (?).
FIRAuth.auth() is non optional so treating them as one might result to the error “Cannot use optional chaining on non optional value 'FIRAuth'”
Optional chaining is a process for querying and calling properties,
methods, and subscripts on an optional that might currently be nil
Check Optional Chaining

typeFromString Action throws exception-uima ruta

The below code throws the error: Action "typeFromString" is not defined.
CW{-> typeFromString("Person")};
From the documentation, I understand that 'Person' is the name of an annotation that need not be declared already using DECLARE statement and that all CW's will be marked as 'Person'. Please correct me if I'm wrong and let me know how to resolve the above error.
There are two problems:
The type function typeFromString throws an exception if the type is not defined in the typesystem of the CAS (should be fixed). Short names work if they are unambiguous.
The editor reports a false error for the type function if it is used as an implicit action. This can be avoided by using CW{-> MARK(typeFromString("Person"))};. typeFromString is not an action but a function returing a type.
DISCLAIMER: I am a developer of UIMA Ruta

got error on xcode7. view.layer.renderInContext(context!)

The error said that "Value of optional type 'CGContext?' not unwrapped; did you mean to use '!' or '?'?".
Does anyone know how to fix this??
view.layer.renderInContext(context!)
If that line is giving you that error, context had to be of type CGContext??.
You can, as the error says, use ! or ? to unwrap the optional resulting from the expression context!.