generator-fountain-webapp
generator-fountain-webapp copied to clipboard
(Angular1+Typescirpt+Webpack)error TS2322: Type '{ filter: (todo: Todo) => boolean; type: string; }' is not assignable to type >'Function'.
Hi, I tried to join slack channel, but the channel was full. I just used the fountain-webapp generator to create angular1-typescript+webpack+todoMVC. With all dependencies installed correct and all typings installed. When I run 'npm run serve,' I got the error message "ERROR in ./src/app/constants/VisibilityFilters.ts (14,22): error TS2322: Type '{ filter: (todo: Todo) => boolean; type: string; }' is not assignable to type >'Function'.
Object literal may only specify known properties, and 'filter' does not exist in type 'Function'." I have no idea what's wrong with the code below:
import {SHOW_ALL, SHOW_COMPLETED, SHOW_ACTIVE} from './TodoFilters';
import {Todo} from '../todos/todos';
function showAll(): boolean {
return true;
}
function showCompleted(todo: Todo): boolean {
return todo.completed;
}
function showActive(todo: Todo): boolean {
return !todo.completed;
}
export default {
[SHOW_ALL]: {filter: showAll, type: SHOW_ALL},
[SHOW_COMPLETED]: {filter: showCompleted, type: SHOW_COMPLETED},
[SHOW_ACTIVE]: {filter: showActive, type: SHOW_ACTIVE}
};
Please give me some advice/help. Thanks.
Error Message & Stack Trace
[23:19:03] Loading D:\Git_Source\yo-angular1\gulp_tasks\browsersync.js [23:19:03] Loading D:\Git_Source\yo-angular1\gulp_tasks\karma.js [23:19:04] Loading D:\Git_Source\yo-angular1\gulp_tasks\misc.js [23:19:04] Loading D:\Git_Source\yo-angular1\gulp_tasks\webpack.js [23:19:05] Using gulpfile D:\Git_Source\yo-angular1\gulpfile.js [23:19:05] Starting 'serve'... [23:19:05] Starting 'webpack:watch'... ts-loader: Using [email protected] and D:\Git_Source\yo-angular1\tsconfig.json [23:19:11] Time: 6335ms Asset Size Chunks Chunk Names index.js 1.57 MB 0 main index.js.map 1.89 MB 0 main
ERROR in ./src/app/constants/VisibilityFilters.ts (14,22): error TS2322: Type '{ filter: (todo: Todo) => boolean; type: string; }' is not assignable to type >'Function'. Object literal may only specify known properties, and 'filter' does not exist in type 'Function'. Child html-webpack-plugin for "index.html": Asset Size Chunks Chunk Names index.html 2.94 kB 0 [23:19:11] Finished 'webpack:watch' after 6.43 s [23:19:11] Starting 'watch'... [23:19:11] Finished 'watch' after 57 ms [23:19:11] Starting 'browsersync'... [23:19:11] Finished 'browsersync' after 51 ms [23:19:11] Finished 'serve' after 6.54 s
Config
Copy the content from .yo-rc.json
:
{
"generator-fountain-angular1": {
"version": "1.0.0-rc1",
"props": {
"framework": "angular1",
"modules": "webpack",
"js": "typescript",
"ci": [],
"css": "css",
"resolved": "C:\\Users\\joomb\\AppData\\Roaming\\npm\\node_modules\\generator-fountain-webapp\\node_modules\\generator-fountain-angular1\\generators\\app\\index.js",
"namespace": "fountain-angular1",
"argv": {
"remain": [],
"cooked": [],
"original": []
},
"sample": "todoMVC",
"router": "uirouter"
}
}
}
Environment
node -e "var os=require('os');console.log('Node.js ' + process.version + '\n' + os.platform() + ' ' + os.release())"
-Node.js v6.7.0 -win32 10.0.14393 yo --version -1.8.5 npm --version -3.10.3
Thanks for the report @yiren ! It should be fixed in next release https://github.com/FountainJS/generator-fountain-angular2/pull/92.
Is it fixed? I just try this with latest tutorial and have same issue.
@Kravs @yiren Next version has been released, can you confirm it fixes your problem ?