Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialBrett Connolly
12,874 Points'types' can only be used in a .ts file (React)
In the React Redux lessons, the part where I create the AddPlayerForm.js file won't let me use
export default class AddPlayerForm extends Component {
static propTypes: {
onAdd: React.PropTypes.func.isRequired,
};
I get an error when defining the 'static propTypes' saying: 'types' can only be used in a .ts file
Brett Connolly
12,874 PointsOk, yeah, i'm using VS Code and the code still compiles fine, the error was just driving my crazy as I thought I was doing something wrong. Thanks for pointing that out Seth Kroger!
1 Answer
Brett Connolly
12,874 PointsApparently this error highlighting has to do with VS Code's internal linter but won't keep the code from compiling or working. Credit to Seth Kroger for pointing this out.
Seth Kroger
56,413 PointsSeth Kroger
56,413 PointsIt that an error from webpack that won't let you build or an error warning from your editor? (VS Code can give that error from its internal linter, but the file will work just fine. It just gets confused between ES6 and TypeScript with that particular syntax.)