fix some small test bugs + refactorings
docs++
Base throws an error if the target state is not defined
add TypeScript definition file
2.0.1