Error while building #angular/material2 - gulp

I just took the latest version of Angular material 2 .
I try to build and it gives gulp build error. I am sure something is wrong , can anyone else try if its building fine.
TSError: тип Unable to compile TypeScript
node_modules/#types/run-sequence/node_modules/#types/gulp/index.d.ts (15,15): Interface 'Gulp' incorrectly extends interface 'Orchestrator'.
Types of property 'task' are incompatible.
Type 'AddMethod' is not assignable to type '{ (name: string): Task; (name: string, fn: TaskFunc): void; (name: string, dep: string[], fn: Tas...'.
Type 'Orchestrator' is not assignable to type 'Task'.
Property 'fn' is missing in type 'Orchestrator'. (2430)
tools/gulp/tasks/ci.ts (4,17): Argument of type 'string[]' is not assignable to parameter of type 'TaskFunction'.
Type 'string[]' provides no match for the signature '(done: (error?: any) => void): any'. (2345)
Node version : v6.9.1
gulp version: 3.9.1
Tried this solution : Unable to run project under Gulp
did not work .
Its great if someone can help me fix this, at least even if I know for sure that its working for others , I will try to fix it.

Related

F#: how to satisfy IStructuralEquatable requirement when implementing an exception with a signature file?

I get a compiler error like this:
The type definitions for type '<ExceptionType>' in the signature and implementation are not compatible because the signature requires that the type supports the interface System.Collections.IStructuralEquatable but the interface has not been implemented
I narrowed it down to the fact that my exception's record type contains a field of a function type.
In my real code, I can work around this because I don't need this function in the exception, but I'm still curious, why do I get this error only when I have a signature file and how would I have my exception implement IStructuralEquatable?
Here's my signature file, Test.fsi:
module Test
type exception_type
exception TestException of exception_type
val throw_test_exception: unit -> unit
Here's my implementation file, Test.fs:
module Test
type exception_type = { value: unit -> unit }
exception TestException of exception_type
let throw_test_exception (): unit =
let r = { value = (fun () -> ()) }
raise (TestException r)
When there's no signature file, everything compiles just fine.
For your signature to work you need to define the full type of exception_type in your signature:
test.fsi
module Test
type exception_type = { value: unit -> unit }
...
Then the error will go away.
Signature files are typically not created by hand.. You can create them using the --sig option.
I'm not sure why would you want to pass a function in an exception. This does not make sense to me but if you elaborate your case (in another question), maybe I might be able to offer some suggestions.

Cannot compile namespaces when the '--isolatedModules' flag is provided - WebStorm

I've this error, I'm using WebStorm.
/src/Component/Professori.tsx
Type error: Cannot compile namespaces when the '--isolatedModules' flag is provided. TS1208
I've also added the flag marked as false into tsconfig.json in this way
"isolatedModules": false
You should use the export keyword post to your component declaration, that in order to be aligned to the ECMAScript standards when declaring a public component. so it should look like that:
const professori = (props: any) => (
...
);
export default professori;
this will resolve the error.

Error: Element type is invalid: expected a string (for built-in components) or a class/function

I am trying to learn react redux api call
so I took an example and implemented in stackblitz but I am getting the below error when I select some channel and hit top news button
can you tell me how to fix it
providing my code and stackblitz below
https://medium.com/#lavitr01051977/basic-react-redux-app-with-async-call-to-api-e478e6e0c48b
https://stackblitz.com/edit/react-redux-realworld-j95tpu?file=actions/index.js
code
export function fetchPosts(channel) {
return function (dispatch) {
dispatch(requestPosts());
return fetch(`https://newsapi.org/v1/articles?source=${channel}&apiKey=${MY_API_KEY}`)
.then(response => response.json(),
error => console.log('An error occurred.', error),
)
.then((json) => {
dispatch(receivedPosts(json));
}, );
};
}
error
VM1672:37 Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in. Check the render method of `TopNews`.
in TopNews (created by Connect(TopNews))
in Connect(TopNews) (created by App)
in div (created by App)
in App
in Provider
Uncaught (in promise) Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in. Check the render method of `TopNews`.
at invariant (invariant.js:42)
at instantiateReactComponent (instantiateReactComponent.js:74)
at instantiateChild (ReactChildReconciler.js:44)
at eval (ReactChildReconciler.js:71)
at traverseAllChildrenImpl (traverseAllChildren.js:77)
at traverseAllChildren (traverseAllChildren.js:172)
at Object.instantiateChildren (ReactChildReconciler.js:70)
at ReactDOMComponent._reconcilerInstantiateChildren (ReactMultiChild.js:185)
at ReactDOMComponent.mountChildren (ReactMultiChild.js:224)
at ReactDOMComponent._createInitialChildren (ReactDOMComponent.js:703)
The actual problem is an import/export syntax issue. I'll walk you through how to find it.
The problem's real location is shown by the component stack trace:
Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in. Check the render method of `TopNews`.
in TopNews (created by Connect(TopNews))
in Connect(TopNews) (created by App)
in div (created by App)
in App
in Provider
If we look in TopNews.js, it only renders <h3>, <div>, and <NewsItem>. h3 and div are just basic tags, so it's probably NewsItem that's the problem.
At the top of TopNews.js, you have:
import { NewsItem } from '../components/NewsItem';
However, in NewsItem.js, you have:
export default NewsItem ;
So, you're doing a default export, but a named import, and so NewsItem is undefined in TopNews.js.
Try changing it to be import NewsItem from "../components/NewsItem" and it should work.

Why won't Scala recognize that I'm extending ListModel<E>?

I am writing my own javax.swing.ListModel<E>:
class Category(...)
class CategoryListModel extends javax.swing.ListModel[Category] {
// not shown: ListModel[Category] interface methods implemented here
...
}
However, when I try to set the list model with:
val myList: JList = ...
myList.setModel(new CategoryListModel)
The compiler gives me this error:
type mismatch;
found : CategoryListModel
required: javax.swing.ListModel[?0] where type ?0
myList.setModel(new CategoryListModel)
I thought CategoryListModel did implement ListModel[Category]??? I am trying to learn Scala by practicing using it lately, but I don't know how to interperet this error.
Okay, so the error was originating in the fact that my JList did not have a type parameter specified (it was generated by a GUI builder). I changed the declaration to:
JList<Category> // this particular file is a Java file
Now everything works.

Type mismatch while using allCatch opt

In order to avoid Java exceptions I'm using Scala's exception handling class.
However, when compiling the following snippet:
import scala.util.control.Exception._
val cls = classManifest[T].erasure
// Invoke special constructor if it's available. Otherwise use default constructor.
allCatch opt cls.getConstructor(classOf[Project]) match {
case Some(con) =>
con.newInstance(project) // use constructor with one Project param
case None =>
cls.newInstance // just use default constructor
};
I receive the following error:
error: type mismatch;
[scalac] found : java.lang.reflect.Constructor[_]
[scalac] required: java.lang.reflect.Constructor[_$1(in method init)] where
type _$1(in method init)
[scalac] allCatch opt cls.getConstructor(classOf[Project]) match {
[scalac] ^
[scalac] one error found
What's going on here and how can I fix it?
I have no explanation, but a much shorter example which I hope pinpoint where the problem occurs. I think it is not related at all to exceptions, nor to reflection. Whether this behavior is an arcane but correct consequence of the specification or a bug, I have no idea.
val untypedList : List[_] = List("a", "b")
val typedList : List[String] = List("a", "b")
def uselessByName[A](a: => A) = a
def uselessByValue[A](a: A) = a
uselessByName(untypedList) fails with the same error as your code. The other combinations do not. So combination of a method with a generic call-by-name argument, called with a parameter of a generic with an existential type.
uselessByName[List[_]](untypedList) works, so I guess if you call explicitly opt[Constructor[_]] it might work too.
The type inference scheme has gotten confused by the types available--specifically, by the type of cls. If we write generic code:
def clser[A](cls: Class[A]) = allCatch opt cls.getConstructor(classOf[Project])
then it works perfectly okay. But you're probably doing something else--I can't tell what because you didn't provide the code--and this results in a mismatch between the expected and actual types.
My currently solution is to cast the constructor explicitly.
cls.getConstructor(classOf[Project]) becomes cls.getConstructor(classOf[Project]).asInstanceOf[Constructor[Project]].
I'm still wondering about the actual error and if there are better ways to resolve it -- so I'm going to leave this open.